Cocos2d-x: Version 3.x Example code snippets


Scale the background image to fill the Screen Add a close button to exit the application Touch Detection (Touch Began, Touch Moved, Touch Ended) HelloWorldScene.h HelloWorldScene.cpp Create a Sprite to the touch Location follow the Touch Detection (Touch Began, Touch Moved, Touch Ended) HelloWorldScene.cpp Accelerate a sprite with device acceleration HelloWorldScene.h HelloWorldScene.cpp Accelerate a sprite … Continue reading Cocos2d-x: Version 3.x Example code snippets

Advertisements

Cocos2dx: Call Java code from C++ or Call C++ code from Java using JNI


Call Java code from C++ Step 1: Include Jni folder Right click on project => Properties => C/C++ General => Paths and Symbols => (Right side) Select Source Location => Click Link Folder => Check Link to folder in the file system => Browse /Cocos2d/cocos2dx/platform/android/jni => Open If the folder already existed in Source location … Continue reading Cocos2dx: Call Java code from C++ or Call C++ code from Java using JNI