Here you can see the structure.
Window
WndProc sends messages to HandleEvent method of Window wrapper.
HandleEvent directly solves messages like window activation/inactivation, dumps screensaver message, process key press/release messages, etc.
I was thinking at first about allowing game to handle all the messages on its own, but in the end these messages seems to be unlikely handled in different way game from game. Only some messages invoke a call of methods in WindowEventHandler class.
WindowEventHandler
When a Window::HandleEvent() receives a certain message, it calls appropriate method of this class.
The game can inherit from this class ( e.g. GameWindowEventHandler ) and override the methods if it wants to handle some messages by itself.
KeyboardListener & KeyHandler
Game can register a callback function for each key ( + combinations of special keys ).
When KEYDOWN message is received, a KeyPressed function is called. This checks if some callback for the key is registered and calls it.
Ship & Character Controller
Static callback method is called from KeyHandler when key is pressed. The callback takes an instance of controlled object (e.g. ship, character, etc. ) and calls its member method to perform the game operation.
For example if we fly a ship, the game registers the methods from ShipController in keyboard listener and when a key is pressed, the appropriate function from ShipController is called directly. If we get off the ship, the game can unregister the old functions and register functions from CharacterController instead. If the same key is then pressed, a function from CharacterController is called now.
I think this can separate pretty nicely different operations that should be performed on different screens by same key. Operations for different screen or game mode will not mess among each other.
Well, so that's all for now. The mouse and possibly joystick handling will be made in a very similar way as keyboard is, but I will keep them for a later time. In the upcomming days I'd like to look on the Renderer and prepare some usable API for it.