Search code examples
iphoneiosuikitd-pad

Is there a UIKit version of sneakyness's cocos2d d-pad?


I started working on a small game just to test peer-to-peer gameplay. Anyway, as time passed I added a lot of features and a small singleplayer campaign. At the begining I put 4 buttons to control the character, because I just wanted something fast so I can check the multiplayer part of the game.

Now I want to switch to a d-pad, but I could only find sneakyness's cocos2d d-pad. I have no experience what-so-ever with cocos2d and I don't want to rewrite the whole game.

Has anybody tried to convert sneakyness's cocos2d d-pad to UIKit only or if you know another d-pad which I might use?


Solution

  • I'm not aware of any virtual joypad library that isn't built for Cocos2D, Unity, Corona or some other engine.

    You can however harness the code that Sneakyinput uses to detect a d-pad touch. It's pretty straightforward even if you don't use cocos2d. Adapting it should not prove too difficult. After all, a D-Pad is just the same as 4 buttons that you need to test for a touch.