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

Author Topic: Out of focus input  (Read 3130 times)

0 Members and 1 Guest are viewing this topic.

dragonmost

  • Newbie
  • *
  • Posts: 3
    • View Profile
Out of focus input
« on: July 16, 2015, 09:25:01 am »
Hey and thanks in advance everyone.

I've been looking around put couldn't find a clear answer.
I want to do a "controller cam" program where you see what input are being made by a controller while gaming.
The issue is, the window can't be in focus since the game has focus. I believe I can't use SFML's joystick class and I cant seem to find a precise answer for this.
So far I got: GetAsyncKeyState function and GetRawInputData function.
Not sure I really understand them so I'de like to know if you guys got any other relevant ways of doing it or any tips on learning to use these functions.

I'm using Visual studio 2013 with SFML C++ on Windows 7
I'm also open to C/C# with different libraries

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Out of focus input
« Reply #1 on: July 16, 2015, 09:27:02 am »
If you're looking for help with Windows API programming, you're at the wrong place here. ;)

Why do you think you can't use the sf::Joystick class?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

dragonmost

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Out of focus input
« Reply #2 on: July 16, 2015, 09:29:33 am »
Why do you think you can't use the sf::Joystick class?

As far as I know it doesn't trigger any event when out of focus

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Out of focus input
« Reply #3 on: July 16, 2015, 09:30:23 am »
sf::Joystick doesn't work with events.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

dragonmost

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Out of focus input
« Reply #4 on: July 16, 2015, 09:39:40 am »
sf::Joystick doesn't work with events.

So I could just make a loop with something like
Keyboard KB;

if (KB.isKeyPressed(KB.A))
        cout << "A";
 

but do it with a joystick.
That's simpler then trying to play with events

AlexAUT

  • Sr. Member
  • ****
  • Posts: 396
    • View Profile
Re: Out of focus input
« Reply #5 on: July 16, 2015, 12:38:15 pm »
I'm not sure if I understand you correctly, but yes there is an joystick API similar to the keyboard one, have a look at the tutorial: http://www.sfml-dev.org/tutorials/2.3/window-inputs.php#joystick


AlexAUT

 

anything