1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#include <windows.h>
int main(int argn, char* args[])
{
bool gotMsg;
MSG msg;
msg.message = WM_NULL;
PeekMessage(&msg, NULL, 0U, 0U, PM_NOREMOVE);
HANDLE hevent = (HANDLE)CreateEvent(NULL, FALSE, FALSE, NULL);
while (WM_QUIT != msg.message)
{
// Use PeekMessage() if the app is active, so we can use idle time to
// render the scene. Else, use GetMessage() to avoid eating CPU time.
//bool dontWaitForMessages = gAppActive || (!gAlreadyClosing && GetPlayerRunInBackground()) || (kPlayerPausing == GetPlayerPause());
bool dontWaitForMessages = false;
if (dontWaitForMessages)
gotMsg = (PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE) != 0);
else
gotMsg = (GetMessage(&msg, NULL, 0U, 0U) != 0);
if (gotMsg) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
else {
// perform main loop
//PerformMainLoop();
}
}
}
|