Graphics.cpp lines 117 to 120:
Code:
do
{
retVal = window.CheckMessages();
} while ((clock() - frameStart) < (1000 / FPS) && window.state == APPSTATE_RUNNING);
Consider using CLOCKS_PER_SEC for greater portability.
[edit] And, because I like enum, I'd suggest using one here (Graphics.h lines 3-11):
Code:
#ifndef APPSTATES
#define APPSTATES
#define APPSTATE_UNINITIALIZED 0
#define APPSTATE_INITIALIZED 1
#define APPSTATE_RUNNING 2
#define APPSTATE_DESTROYING 3
#define APPSTATE_DESTROYED 4
#define APPSTATE_PAUSED 5
#endif
Mainly because you wouldn't have to keep track of the numbers.
Code:
#ifndef APPSTATES
#define APPSTATES
enum {
APPSTATE_UNINITIALIZED,
APPSTATE_INITIALIZED,
APPSTATE_RUNNING,
APPSTATE_DESTROYING,
APPSTATE_DESTROYED,
APPSTATE_PAUSED
};
#endif
And then, of course, instead of this (Graphics.h line 18):
You could use this (assuming you named the enum):
Code:
enum appstate {
/* ... */
};
/* ... */
appstate state;
In C++, you can't actually assign any old integer to an enum (without a cast, anyway), so you get extra type-safety. You won't assign 18 by accident, which isn't an APPSTATE, of course.
[edit=2]
Also, this looks weird, but I guess it works.
Code:
displayX = (int)(short)LOWORD(lParam);
[/edit]
[edit=3]
From lines 13-27 of Application.cpp:
Code:
unsigned CApplication::Run()
{
int retVal;
state = APPSTATE_RUNNING;
retVal = graphics.Run();
state = APPSTATE_DESTROYING;
graphics.Destroy();
state = APPSTATE_DESTROYED;
return retVal;
}
You're storing the unsigned result of graphics.Run() in a signed int; then you return that from an unsigned function; then you return that as a signed int from main(). Perhaps it would make more sense to make up a standard, like only signed ints? [/edit]