SFML community forums
Help => Window => Topic started by: svrtgujbhk on June 07, 2011, 04:59:35 pm
-
The way my engine is set up right now, input events are entirely separate from the view/window (they are two unrelated modules).
From what I've seen, input in SFML can only be read through a specific Window; this is a bit at odds with how my engine works. Is there a way to read input globally in SFML (ie. not through a Window)?
I could solve the problem by having a singleton wrapper over the SFML Window, but I'd rather avoid that if possible.
-
There's no way to do so, a sf::Input provides the input states of a particular window, not the global ones.
It's not just different technically, it's two different things: window inputs only reflect what happens when the window has the focus, while global inputs reflect the global mouse/keyboard states.
-
Okay, thanks. Guess I'll have to resort to the singleton.
I was thinking something like an aggregate of all input occurring on all Window objects, not global as in operating system global.
Out of curiosity, is it hard for you to implement something like this in SFML (an aggregate of all Window inputs)? It's not a request, just a question. :)
-
Out of curiosity, is it hard for you to implement something like this in SFML (an aggregate of all Window inputs)?
Probably not.