mercoledì 2 settembre 2015

Day 59: Game Controller

Today I decided to configure the engine to work with a game controller.
Thankfully my ps4 controller is very easy to configure on a PC compared to the old ps3 dualshock, so I started very easily.
I had to configure SDL to read data from the controller, and then I needed to manually program a lot of things: button mapping, dead zones of the analogs, mapping from analog valus to the range [-1;1] and so on.
In the end I managed to give to the controller all the feature already used by the mouse: control the camera over the screen with rotations and movement, issue commands with buttons and so on.
I had litterally no problems today, everything went smooth and the system is perfect for now.
I will probably add in the future a few features, like a buffer to stabilize the joystick movement (sampling the last three values to avoid imprecise movements), but for now i'm happy with it.

Nessun commento:

Posta un commento