Controller Input System - Update 1
A downloadable game
Engine System Update #1
What I did?
I started off by creating a new project and then setup the necessary dependencies. After some research on the internet, I tried to get whether the controller is connected from the functions defined in the winuser.h (Get Raw Input function specifically) and I was able to detect the controller. That felt really good but reading from the raw state seemed daunting as there are a lot of variables which didn’t make much sense to me.
And at the same time, I came across DirectInput and XInput libraries (Later JP suggested them too, I wasn’t sure whether I can use them in the beginning), and they provide some easy to use functions to get the states of the controller. After some research I choose to use XInput because it has some more functionalities like able to rumble the controllers also getting the headset states.
Then I started looking at the documentation of the Xinput library functions. I was able to implement two functions in my interface
- -Bool IsConnected()
- -Void RumbleController(float i_amount)
Checking whether a controller is connected
Adding rumble when H key is pressed
I find this funny - I’m trying to do a Controller Input system and using keyboard to test whether it works
The first function will help to know whether any controllers are connected and the second function creates a rumble effect on the controller.
Further Steps:
- Reading Input from the controller state
- Enums for buttons
- Call backs for button presses
Leave a comment
Log in with itch.io to leave a comment.