a bunch of stuff

This commit is contained in:
Eduardo Bart
2011-05-11 19:16:11 -03:00
parent 42c1ae090c
commit c6753747fb
63 changed files with 663 additions and 375 deletions

View File

@@ -82,12 +82,12 @@ void Configs::setValue(const std::string &key, const char *value)
void Configs::setValue(const std::string &key, int value)
{
setValue(key, convertType<std::string, int>(value));
setValue(key, convert_cast<std::string>(value));
}
void Configs::setValue(const std::string &key, float value)
{
setValue(key, convertType<std::string, float>(value));
setValue(key, convert_cast<std::string>(value));
}
void Configs::setValue(const std::string &key, bool value)
@@ -116,7 +116,7 @@ float Configs::getFloat(const std::string &key) const
flogWarning("WARNING: Config value %s not found", key.c_str());
return 0;
}
return convertType<float, std::string>(it->second);
return convert_cast<float>(it->second);
}
bool Configs::getBoolean(const std::string &key) const
@@ -136,5 +136,5 @@ int Configs::getInteger(const std::string &key) const
flogWarning("WARNING: Config value %s not found", key.c_str());
return 0;
}
return convertType<int, std::string>(it->second);
return convert_cast<int>(it->second);
}

View File

@@ -31,6 +31,7 @@
#include <ui/uicontainer.h>
#include <net/connection.h>
#include <script/luascript.h>
#include <ui/uiskins.h>
Engine g_engine;
@@ -38,23 +39,24 @@ void Engine::init()
{
// initialize stuff
g_graphics.init();
g_fonts.init("tibia-12px-rounded");
g_fonts.init();
g_lua.init();
}
void Engine::terminate()
{
// terminate stuff
g_fonts.terminate();
g_graphics.terminate();
// destroy root ui
UIContainer::getRoot()->destroy();
// cleanup script stuff
g_lua.terminate();
// poll remaning events
g_engine.poll();
// terminate stuff
g_fonts.terminate();
g_graphics.terminate();
}
void Engine::poll()
@@ -78,7 +80,7 @@ void Engine::run()
std::string fpsText;
Size fpsTextSize;
Font *defaultFont = g_fonts.getDefaultFont();
FontPtr defaultFont = g_uiSkins.getDefaultFont();
m_lastFrameTicks = Platform::getTicks();
int lastFpsTicks = m_lastFrameTicks;
@@ -93,7 +95,7 @@ void Engine::run()
// render only when visible
if(Platform::isWindowVisible()) {
// calculate and fps
// calculate fps
if(m_calculateFps) {
frameCount++;
if(m_lastFrameTicks - lastFpsTicks >= 1000) {
@@ -102,7 +104,7 @@ void Engine::run()
frameCount = 0;
// update fps text
fpsText = f("FPS: %d", fps);
fpsText = fmt("FPS: %d", fps);
fpsTextSize = defaultFont->calculateTextRectSize(fpsText);
}
}