Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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?

share|improve this question
1  
Move the window logic in its own system which passes information to both input and graphics system. –  danijar Nov 30 '13 at 12:07

1 Answer 1

up vote 3 down vote accepted

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:

UML diagram

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.

share|improve this answer
    
The lesson here is that you cannot abstract away reality +1 =) –  Patrick Hughes Nov 30 '13 at 19:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.