mirror of
https://github.com/edubart/otclient.git
synced 2025-10-19 05:53:26 +02:00
scripting rework
This commit is contained in:
@@ -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;
|
||||
|
@@ -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)
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user