This section explains the configuration and initialization effort required for SDK integration of C++ (Cocos2d-x) game. After complete the efforts described in this section, please continue the integration effort for other function module.
iOS Integration
Download C++ SDK, and then follow the same step as Setup for iOS integration.
Cocos2D-X
Declare a property named window in file AppController.h
#import <UIKit/UIKit.h>
@class RootViewController;
@interface AppController : NSObject <UIApplicationDelegate>
{
UIWindow *window;
}
@property(nonatomic, readonly) RootViewController* viewController;
@property (strong, nonatomic) UIWindow *window;
@end
Android Integration
Step 1. Setting Up JNI
-
Move KTPlaySDK/KTPlay/libs/armeabi to game's jin folder, tips, use "move" as to avoid duplicated .so during execution.
-
Copy all files from Include to game's jni folder.
Step 2. Setup Android.mk
In game's jni folder, open Android.mk file and append the following section:
include $(CLEAR_VARS)
LOCAL_MODULE := libKTPlay
LOCAL_SRC_FILES := libKTPlay.so
LOCAL_MODULE_FILENAME := libKTPlay
include $(PREBUILT_SHARED_LIBRARY)
if LOCAL_SHARED_LIBRARIES is defined, then add the following:
LOCAL_SHARED_LIBRARIES+= libKTPlay
if LOCAL_SHARED_LIBRARIES not defined, then add the following:
LOCAL_SHARED_LIBRARIES:= libKTPlay
Step 3. Load SDK shared library in your game
Before loading your game's shared libraries, call the following code to load SDK's shared library first.
System.loadLibrary("KTPlay");
//rest of your shared libraries loading code go here.
0 Comments