Hey guys,
I'm using an instance of my GameObject class holding an instance of an InputComponent class, whichs checks sf::Keyboard/sf::Mouse/sf::Joystick to detect user input. So the input component can trigger further actions of the GameObject on each case. But I'm not sure whether this is the right solution for me.
Using this "oldschool" way (means: querying the entire input set on each frame) might cause additional overhead because of checking the entire set on each frame ^^ This seems not so great to me in case of detecting whether the key was pressed/released in this frame, because I need to do this on my self. This isn't a problem to me, but it might be not necessary at all, because SFML provides an event-driven API using sf::Event.
But pulling all events and calling all GameObject's InputComponent's handle()-method might also be not so clever, because each GameObject will be addressed on each event - even if the object would ignore it completly. But (but but but xD) ... but introducing some more intelligent pattern - like registering an object for a limited set of events - seems to be architectural overhead.
Am I wrong in any of this cases? Well, I'm not sure what's the right way for me.. And because this seems an architectural problem I'm gonna solve it now, before writing further input code using "the wrong" design.
Any suggestions?
Kind regards
Glocke