• interested in more? sign up to the newsletter

     

Attempting full controller support

Tweet about this on TwitterShare on RedditShare on Facebook

The openness of Android is beautiful, but it also means supporting many things can be a pain. One of those problems can be the controls for your game. I’m always in favor of supporting as many control options as possible, but this sometimes bumps with my love of having as little “settings” for the end user.

I’ve been implementing controls for hardware keyboards, wiimotes, xperia play and various different “gamegripper” settings, and recently I found that the iCade also works on Android and has another set of controls.

So today I decided to dive into my control code, clean it up, improve it, and make it easier to modify and extend. The code is now very clean (I think) and easy to use in any game. It’s not tested on all devices yet, so I probably end up rewriting and debugging various parts, but for now this looks pretty solid (tested on xperia play, keyboard, icade and wiimote):

 
Source on Pastebin

If you have any improvements or feedback, let me know!

Bookmark the permalink.