Game Development Reference
It may not be immediately obvious what you have to do to download the source code
from GitHub. When you click a file, you see the actual source code displayed in your
browser. But you want the full source code project, not individual files. What you do is
locate either the Downloads tab below the upper right-hand corner of the web site, or
the ZIP button on the left side of the page just between the Clone in Mac and HTTP|Git
Read-Only buttons. Then save the file to your computer and extract it.
Because SneakyInput comes with an example project that has cocos2d integrated, it's
likely that the cocos2d version used by the SneakyInput demo project may not be the
most current version, or may not even compile. For the rest of the chapter that doesn't
matter, as I'll cherry-pick the code that works with cocos2d 2.0.
You already have a working project and you don't want to use the project provided by
SneakyInput. So how do you get it to work with your project?
This issue isn't limited to SneakyInput but possibly any source code project you can
download that comes already bundled with its own version of cocos2d. In most cases,
and as long as the programming language of that source code is Objective-C, you only
have to figure out which of the project's files are necessary and add them to your own
project. There's no clear guideline, however, because every project is different.
I can tell you which files you need to add to your project regarding SneakyInput,
however. It consists at its core of four classes:
▪ SneakyButton and SneakyButtonSkinnedBase
▪ SneakyJoystick and SneakyJoystickSkinnedBase
The remaining files aren't needed but may serve as references, except for the Co-
loredCircleSprite and ColoredSquareSprite classes, which are incom-
patible with cocos2d 2.0. Figure 7-9 shows the selection in the Add Files To … dialog.