first script stuff (still ugly and under experiments)

This commit is contained in:
Eduardo Bart
2011-04-18 23:10:08 -03:00
parent 3de455fe7e
commit bb05338190
11 changed files with 77 additions and 5 deletions

View File

@@ -41,7 +41,7 @@ public:
/// Fired when leaves the state
virtual void onLeave() = 0;
/// Fired when user tryes to close the window
/// Fired when user tries to close the window
virtual void onClose() = 0;
/// Fired for every user input event, this is called before processing UI input and if it returns false the input is not passed to the UI
virtual bool onInputEvent(const InputEvent& event) = 0;

View File

@@ -279,7 +279,7 @@ const std::vector<Point>& Font::calculateGlyphsPositions(const std::string& text
if(textBoxSize) {
textBoxSize->setWidth(maxLineWidth);
textBoxSize->setHeight(virtualPos.y + m_glyphHeight + m_glyphSpacing.height());
textBoxSize->setHeight(virtualPos.y + m_glyphHeight);
}
return glyphsPositions;

View File

@@ -31,6 +31,7 @@
#include <ui/uiskins.h>
#include "menustate.h"
#include "teststate.h"
#include <script/script.h>
/// Catches signals so we can exit nicely
void signal_handler(int sig)
@@ -109,6 +110,8 @@ int main(int argc, const char *argv[])
// init engine
g_engine.init();
g_script.init();
g_script.loadFile("lib/init.lua");
g_uiSkins.load("skins/tibiaskin.yml");
// state scope

View File

@@ -32,12 +32,15 @@
#include <graphics/fonts.h>
#include <ui/ui.h>
#include "menustate.h"
#include <script/script.h>
void MenuState::onEnter()
{
m_background = g_textures.get("background.png");
m_background->enableBilinearFilter();
g_script.loadFile("modules/mainmenu/init.lua");
/*
UIContainerPtr mainMenuPanel = UILoader::loadFile("ui/mainMenu.yml")->asUIContainer();
UIButtonPtr button = boost::static_pointer_cast<UIButton>(mainMenuPanel->getChildById("exitGameButton"));
@@ -51,6 +54,7 @@ void MenuState::onEnter()
button = boost::static_pointer_cast<UIButton>(mainMenuPanel->getChildById("optionsButton"));
button->setOnClick(boost::bind(&MenuState::optionsButton_clicked, this));
*/
}
void MenuState::onLeave()