Original Post
I''ve been experimenting with GDI for a while and now I''m trying to make a simple game that updates and renders even when there are no messages in the queue. Here is my main loop:
So it runs and renders all fast but now my problem is that it seems to slow the rest of my system down a lot. For example, if I go to move the window, it waits a few seconds then moves. Or if I hit the ''X'' it waits a second and then closes. When my window moves, the programs underneath seem to have trouble repainting themselves. In VB, I would just through a DoEvents statement in there somewhere but I have no idea how to solve this problem in C++.
while (boolGameOn)
{
if (PeekMessage (&messages, NULL, 0, 0, PM_REMOVE))
{
if (messages.message==WM_QUIT)
{ break;}
TranslateMessage(&messages);
DispatchMessage(&messages);
}
else
{
//This is where I update and render
}
}