Game Development Reference
Caution Virtual joypads resemble joypad controllers in looks but never in feel.
The user is still touching a flat surface with no feedback to the fingers as to how
far the virtual analog stick was moved or whether the virtual button has actually
been pressed or was missed. A number of players feel uneasy controlling a
game with virtual joypads. It has become more or less common wisdom that a
virtual joypad should have no more than two or three controller elements, usu-
ally a stick/pad (sometimes limited to two directions) and one or two buttons.
Adding more can make your game exponentially harder to control. Also con-
sider that you can often replace at least one axis of the directional buttons with
input from the accelerometer, so that the user can tilt the device to move left or
right instead of holding the corresponding virtual buttons.
Over time, many a developer has faced the problem of implementing a virtual joypad.
There are many ways to go about it, and even more ways to fail at it. But why spend
time on that if there's a ready-to-use solution?
This is generally sound advice. Before you program anything that seems reasonably
common, which others have probably worked on before, always check to see whether a
general-purpose solution is available that you can just use instead of having to spend a
lot of time creating it yourself. In this case, SneakyInput is just too good to be ignored.
SneakyInput was created by Nick Pannuto, with skinning examples by CJ Hanson.
SneakyInput is open source software and free to download, but if you like this product,
please consider making a donation to Nick Pannuto here: http://pledgie.com/
Kobold2D users don't need to concern themselves—SneakyInput is already part of the
Kobold2D distribution. Kobold2D users can skip the next two sections.
The SneakyInput source code is hosted on GitHub, a social coding web site: ht-