scripting rework

This commit is contained in:
Eduardo Bart
2011-05-02 19:48:41 -03:00
parent f290b4f89c
commit c052723477
24 changed files with 622 additions and 375 deletions

View File

@@ -44,7 +44,7 @@ public:
void setValue(const std::string &key, bool value);
void setValue(const std::string &key, int value);
const std::string &getString(const std::string &key) const;
const std::string& getString(const std::string &key) const;
float getFloat(const std::string &key) const;
bool getBoolean(const std::string &key) const;
int getInteger(const std::string &key) const;

View File

@@ -30,6 +30,7 @@
#include <graphics/fonts.h>
#include <ui/uicontainer.h>
#include <net/connection.h>
#include <script/luascript.h>
Engine g_engine;
@@ -116,10 +117,12 @@ void Engine::run()
m_stopping = false;
m_running = false;
g_lua.collectGarbage();
// destroy root ui
rootContainer->destroy();
// poll remaning ui events
// poll remaning events
g_engine.poll();
}
@@ -130,8 +133,7 @@ void Engine::stop()
void Engine::onClose()
{
if(m_onCloseCallback)
g_dispatcher.addTask(m_onCloseCallback);
g_dispatcher.addTask(boost::bind(&LuaScript::callModuleField, &g_lua, "App", "onClose"));
}
void Engine::onResize(const Size& size)

View File

@@ -63,16 +63,12 @@ public:
/// Return the current ticks on this frame
int getCurrentFrameTicks() const { return m_lastFrameTicks; }
void setOnClose(SimpleCallback onCloseCallback) { m_onCloseCallback = onCloseCallback; }
private:
bool m_stopping;
bool m_running;
bool m_calculateFps;
int m_lastFrameTicks;
SimpleCallback m_onCloseCallback;
};
extern Engine g_engine;