message loop in directx
-
Hi, I am trying to write a fullscreen game... and I have a question about the message loop I am curently using the following form:
while(msg.message!=WM_QUIT) if(PeekMessage(&msg,0,0,0,PM_REMOVE)){ TranslateMessage(&msg); DispatchMessage(&msg); } else Render();
whitch ain't so bad for the momment, but in future it's gonna have multiplayer and user input,and other stuff.I saw in Quake3's source the loop was way diffrent. And now the question: Can anyone(hwo had previously worked whit somethings like that ...hopefully)give me an ideea about how the message loop should be like. Thnaks -
Hi, I am trying to write a fullscreen game... and I have a question about the message loop I am curently using the following form:
while(msg.message!=WM_QUIT) if(PeekMessage(&msg,0,0,0,PM_REMOVE)){ TranslateMessage(&msg); DispatchMessage(&msg); } else Render();
whitch ain't so bad for the momment, but in future it's gonna have multiplayer and user input,and other stuff.I saw in Quake3's source the loop was way diffrent. And now the question: Can anyone(hwo had previously worked whit somethings like that ...hopefully)give me an ideea about how the message loop should be like. ThnaksThe Quake 3 source isn't that much different (and neither is most other PC games message loops):
WPARAM MainLoop() { MSG msg; while (1) { if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { if (msg.message == WM_QUIT) break; TranslateMessage(&msg); DispatchMessage(&msg); } else { // rendering calls goes here } } // cleanup code goes here return msg.wParam; }
It really isn't that much different than what you have.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week Zac