Message Loop

Hello, I have a game engine. I would like to be able to let the current state (scene) handle the windows event. So, I was assuming that i would do something like
1
2
3
4
5
6
7
        if (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) {// See if we have a message
            if(msg.message == WM_QUIT) Game.Quit();// Quit the game if the quit message is sent
            if(msg.message == WM_SIZE) assert(false);// If something went wrong send an error
            TranslateMessage(&msg);// Figure out what the message is saying
            DispatchMessage(&msg);// Hand the message to the windproc
            /* GameEngine.HandleEvents(msg); */
        }


# Line 6 is the key

This works partialiy. I can get some windows messages like WM_MOUSEMOVE but I cannot get WM_SIZE (I need this one in particular, along with WM_LEFTBUTNDOWN) So how can I get all of the messages that WndProc revives to my game engine.

I thought about using a singleton and just using a static Instance() function, but there can be more than one game. So could you guys help?
Last edited on
Topic archived. No new replies allowed.