Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Can I pull events without having a window?  (Read 1380 times)

0 Members and 1 Guest are viewing this topic.

Grime

  • Newbie
  • *
  • Posts: 13
    • View Profile
Can I pull events without having a window?
« 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)
« Last Edit: February 20, 2019, 11:27:51 am by Grime »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10846
    • View Profile
    • development blog
    • Email
Re: Can I pull events without having a window?
« Reply #1 on: February 20, 2019, 02:15:54 pm »
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.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Grime

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: Can I pull events without having a window?
« Reply #2 on: February 20, 2019, 05:08:25 pm »
Hmmm, okay thanks.
How would I make a window hidden if I were to?

G.

  • Hero Member
  • *****
  • Posts: 1592
    • View Profile
Re: Can I pull events without having a window?
« Reply #3 on: February 20, 2019, 05:45:21 pm »

 

anything