Graphics.cpp lines 117 to 120:
Consider using CLOCKS_PER_SEC for greater portability.Code:do { retVal = window.CheckMessages(); } while ((clock() - frameStart) < (1000 / FPS) && window.state == APPSTATE_RUNNING);
[edit] And, because I like enum, I'd suggest using one here (Graphics.h lines 3-11):
Mainly because you wouldn't have to keep track of the numbers.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
And then, of course, instead of this (Graphics.h line 18):Code:#ifndef APPSTATES #define APPSTATES enum { APPSTATE_UNINITIALIZED, APPSTATE_INITIALIZED, APPSTATE_RUNNING, APPSTATE_DESTROYING, APPSTATE_DESTROYED, APPSTATE_PAUSED }; #endif
You could use this (assuming you named the enum):Code:unsigned 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.Code:enum appstate { /* ... */ }; /* ... */ appstate state;
[edit=2]
Also, this looks weird, but I guess it works.
[/edit]Code:displayX = (int)(short)LOWORD(lParam);
[edit=3]
From lines 13-27 of Application.cpp:
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]Code:unsigned CApplication::Run() { int retVal; state = APPSTATE_RUNNING; retVal = graphics.Run(); state = APPSTATE_DESTROYING; graphics.Destroy(); state = APPSTATE_DESTROYED; return retVal; }



LinkBack URL
About LinkBacks




CornedBee
