SneakyInput is a virtual joystick library. SneakyInput is the virtual handle in 2dx. But the 2dx version downloaded from the official website is too old, to modify him, applicable to cocos2d-x 2.1.4 version. In theory, it applies to all 2dx versions 2.1 +. Go to the topic: [cpp] # include "SneakyInput/SneakyJoystickSkinnedBase. h "# include" SneakyInput/SneakyButtonSkinnedBase. h "SneakyButton * button; SneakyJoystick * joystick; defines the SneakyInput joystick and obtains the joystick data. Definition: [cpp] SneakyJoystickSkinnedBase * joystickBase = new kernel (); joystickBase-> autorelease (); joystickBase-> init (); joystickBase-> setBackgroundSprite (CCSprite: create ("B .png"); // Base JoystickBase-> setThumbSprite (CCSprite: create ("f.png"); // joystickBase-> setPosition (CCPointMake (48, 48); joystickBase = new SneakyJoystick (); joystick-> autorelease (); joystick-> initWithRect (CCRectMake (, 64); joystickBase-> setJoystick (joystick ); // whether to automatically return to the center joystick-> setAutoCenter (true); // whether the dead zone is supported. joystick-> setHasDeadzone (true) is not triggered in this region ); // death zone radius joystick-> setDeadRadius (10); this-> addChild (JoystickBase); get data: [cpp] joystick-> getVelocity (); Define the button of SneakyInput and the data of the get button: Define button: [cpp] <span style = "white-space: pre"> </span> // button skin SneakyButtonSkinnedBase * buttonBase = new SneakyButtonSkinnedBase (); buttonBase-> autorelease (); buttonBase-> init (); buttonBase-> setdefasprsprite (CCSprite: create ("default.png"); buttonBase-> setActivatedSprite (CCSprite: create ("activated.png ")); buttonBase-> setPre SsSprite (CCSprite: create ("press.png"); buttonBase-> setPosition (CCPointMake (480-48, 48); // button = new SneakyButton (); button-> autorelease (); button-> initWithRect (CCRectMake (, 32, 32); button-> setIsToggleable (false); // when you press the button, whether to keep the following status: button-> setIsHoldable (true); buttonBase-> setButton (button); this-> addChild (buttonBase); get data: [cpp] button-> getIsActive (); // If the button is pressed, the data is generally obtained in update (float dt. [Cpp] void HelloWorld: update (float dt) {if (button-> getIsActive () {CCLog ("fire! ");} CCPoint scaledV = ccpMult (joystick-> getVelocity (), 1); float x = scaledV. x; float y = scaledV. y; CCLog ("% f --- % f", x, y );}