D2 log 025 – Game controller support

Devastro 2 is going to be a twin stick shooter, so I thought it would be appropriate to add support for game controllers.

I purchased the XBox One Wireless controller for testing. Also ordered the Steam Controller while it was on sale for $5, even though it has zero sticks.

My first implementation used the native game controller API built into macOS but later I switched to the SDL interface. The only major difference is that SDL doesn’t handle dead zones and gives raw readings. It wasn’t too hard to take care of that.

Controlling my game character using the gamepad works really well. I will tweak the button mapping (weapon switch, dash) after some more playtesting.

Menu navigation was a little tricky. All menu items are now linked with next / previous pointers to support DPAD navigation. I’m going to add left / right links as well to better support more complex menus, such as level selection.