Reputation: 21
I'm trying to connect an XBOX 360 controller to get input for a program, but my program will never register a connected controller -- I have confirmed the controller is connected.
I'm running Windows, programming in C++, and using QT for my IDE. My code is just from: https://www.codeproject.com/articles/26949/xbox-controller-input-in-c-with-xinput
The only code I did not use from that site are the includes. My includes are just:
#include <Windows.h> #include <Xinput.h>
and my Xinput lib is included in my .pro as:
win32: LIBS += -lXinput9_1_0
When I run the code, the program never connects to my controller.
Is there something I am missing or that I have messed up?
Upvotes: 1
Views: 907
Reputation: 21
Well, after spending a considerable amount of time searching and reading I reexamined my code and found that I never assigned a player number.
XBOXController* Player1 = new XBOXController(1);
where my bad code was just:
XBOXController* Player1 = new XBOXController;
Yay simple fixes.
Upvotes: 1