display motd message only once, remove update loop, use g_platform.getTicks() instead

This commit is contained in:
Eduardo Bart
2011-08-16 09:47:30 -03:00
parent 99d677913a
commit 758b4b5dfb
14 changed files with 86 additions and 150 deletions

View File

@@ -14,8 +14,11 @@ public:
/// Poll platform input/window events
void poll();
/// Get current time in milliseconds since init
int getTicks();
void updateTicks();
/// Get current time in milliseconds since last application init
int getTicks() { return m_lastTicks; }
/// Sleep in current thread
void sleep(ulong ms);
@@ -58,6 +61,7 @@ public:
private:
PlatformListener* m_listener;
int m_lastTicks;
};
extern Platform g_platform;

View File

@@ -38,6 +38,7 @@ struct X11PlatformPrivate {
int height;
int x;
int y;
int lastTicks;
std::string clipboardText;
std::map<int, uchar> keyMap;
PlatformListener* listener;
@@ -240,7 +241,7 @@ void Platform::init(PlatformListener* platformListener, const char *appName)
x11.atomWindowMaximizedHorz = XInternAtom(x11.display, "_NET_WM_STATE_MAXIMIZED_HORZ", False);
// force first tick
Platform::getTicks();
updateTicks();
}
void Platform::terminate()
@@ -447,7 +448,7 @@ void Platform::poll()
}
}
int Platform::getTicks()
void Platform::updateTicks()
{
static timeval tv;
static ulong firstTick = 0;
@@ -456,7 +457,7 @@ int Platform::getTicks()
if(!firstTick)
firstTick = tv.tv_sec;
return ((tv.tv_sec - firstTick) * 1000) + (tv.tv_usec / 1000);
m_lastTicks = ((tv.tv_sec - firstTick) * 1000) + (tv.tv_usec / 1000);
}
void Platform::sleep(ulong miliseconds)