Platform modtime, little changes to entergame

This commit is contained in:
Henrique Santiago 2013-03-01 05:08:30 -03:00
parent 120c2b4231
commit e85afd4b63
6 changed files with 28 additions and 5 deletions

View File

@ -1,4 +1,9 @@
EnterGameWindow < MainWindow EnterGameWindow < MainWindow
!text: tr('Enter Game')
size: 236 274
EnterGameButton < Button
width: 64
ServerListButton < UIButton ServerListButton < UIButton
size: 17 17 size: 17 17
@ -16,8 +21,6 @@ ServerListButton < UIButton
EnterGameWindow EnterGameWindow
id: enterGame id: enterGame
!text: tr('Enter Game')
size: 236 274
@onEnter: EnterGame.doLogin() @onEnter: EnterGame.doLogin()
MenuLabel MenuLabel
@ -130,9 +133,8 @@ EnterGameWindow
anchors.top: prev.bottom anchors.top: prev.bottom
margin-top: 2 margin-top: 2
Button EnterGameButton
!text: tr('Ok') !text: tr('Ok')
width: 64
anchors.right: parent.right anchors.right: parent.right
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
@onClick: EnterGame.doLogin() @onClick: EnterGame.doLogin()

View File

@ -90,6 +90,7 @@ void Application::registerLuaFunctions()
g_lua.bindSingletonFunction("g_platform", "getCPUName", &Platform::getCPUName, &g_platform); g_lua.bindSingletonFunction("g_platform", "getCPUName", &Platform::getCPUName, &g_platform);
g_lua.bindSingletonFunction("g_platform", "getTotalSystemMemory", &Platform::getTotalSystemMemory, &g_platform); g_lua.bindSingletonFunction("g_platform", "getTotalSystemMemory", &Platform::getTotalSystemMemory, &g_platform);
g_lua.bindSingletonFunction("g_platform", "getOSName", &Platform::getOSName, &g_platform); g_lua.bindSingletonFunction("g_platform", "getOSName", &Platform::getOSName, &g_platform);
g_lua.bindSingletonFunction("g_platform", "getFileModificationTime", &Platform::getFileModificationTime, &g_platform);
// Application // Application
g_lua.registerSingletonClass("g_app"); g_lua.registerSingletonClass("g_app");

View File

@ -43,6 +43,7 @@ public:
std::string getCPUName(); std::string getCPUName();
double getTotalSystemMemory(); double getTotalSystemMemory();
std::string getOSName(); std::string getOSName();
time_t getFileModificationTime(const std::string& filename);
}; };
extern Platform g_platform; extern Platform g_platform;

View File

@ -160,5 +160,15 @@ std::string Platform::getOSName()
return std::string(); return std::string();
} }
time_t Platform::getFileModificationTime(const std::string& filename)
{
struct stat attrib;
if(stat(filename.c_str(), &attrib))
perror(filename.c_str());
else
return attrib.st_mtime;
return 0;
}
#endif #endif

View File

@ -401,4 +401,13 @@ std::string Platform::getOSName()
return ret; return ret;
} }
time_t Platform::getFileModificationTime(const std::string& filename)
{
//TODO
/*WIN32_FILE_ATTRIBUTE_DATA fileAttrData = {0};
GetFileAttributesEx(filename.c_str(), GetFileExInfoStandard, &fileAttrData);
return fileAttrData.ftLastWriteTime;*/
return 0;
}
#endif #endif

View File

@ -83,7 +83,7 @@ public:
c += (color.g() / 51) * 6; c += (color.g() / 51) * 6;
c += (color.b() / 51); c += (color.b() / 51);
return c; return c;
}; }
static Color from8bit(int color) { static Color from8bit(int color) {
if(color >= 216 || color <= 0) if(color >= 216 || color <= 0)