I want to keep Input System and Graphics System separate, but the Window Handler that's created by graphics component make everything really hard. How should I approach this situation?
|
Usually, you can't really separate window and input handling properly (when using events rather than polling the status). IMO this is perfectly valid and not a part of bad design (reimplementing everything twice would be). I've just made a quick "sketch". It's been ages since I did UML, so might include mistakes - but it should get the idea across: As you can see, the input/graphics handler is clearly separated and replaceable, while still depending on the same window implementation (e.g. a Win32 window with it's event handling). Of course, the connection between these interfaces and the game systems could be completely different and not related to direct access or polling, e.g. there could be a message bus, global data fields, etc. but that's not really important here. |
|||||
|