SFML community forums
Help => General => Topic started by: Grime on February 20, 2019, 11:16:07 am
-
I need to pull events without having a visible window. Can this be done without a window class? If I need to have a window class can I have it be hidden and always taking events even when it's not active?
I want this because: standard library of C++ doesn't allow taking of input without 'enter' following the input. So I was hoping SFML could help me with it.
Of course I could probably use SFML for the entire project but I'm only doing simple stuff.
Can I pull events from regular console that pops up when you run a C++ program (I use windows, so presumably we're talking about the windows console).
(While using SFML)
-
No, you can't poll events without a window. Even if you hide the window, you won't get events when you don't have the window in focus.
You can use sf::Keyboard::isKeyPressed(), but that will make your code quite ugly.
-
Hmmm, okay thanks.
How would I make a window hidden if I were to?
-
With sf::Window::setVisible (https://www.sfml-dev.org/documentation/2.5.1/classsf_1_1Window.php#a160f7f11a207603d7e99ce606e749703)