I'm working on a game framework with DirectX/Win32. One of the main classes, "Game", is similiar to the XNA "Game" class. You derive from it and override the loop methods.
I made a test program to test it and it works just fine. The only problem is, the cursor is always an hourglass as long as the cursor is within the window.
It seems to be recieving and using WndProc to process messages just fine. It responds to closing the window and Alt-F4. Wouldn't the hourglass mean it wasn't?
Anyways, I'll give you the loop code:
// Start the game loop.
while (m_running)
{
// Read Windows messages.
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
// Check for quit message.
if (msg.message == WM_QUIT) {
value = 0;
m_running = false;
}
// Decode and pass message.
TranslateMessage(&msg);
DispatchMessage(&msg);
} else {
// Update the game.
Update();
// Draw the game.
Draw();
}
}
And the WndProc code:
LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return DefWindowProc( hWnd, msg, wParam, lParam );
}