Commit 0e6e01b2 0e6e01b22b196fa50f85ec2ce116f0b383128205 by jinwawa

complete hot-update and build

1 parent 8b65d668
Showing 318 changed files with 3042 additions and 1 deletions
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
5 /library/ 5 /library/
6 /temp/ 6 /temp/
7 /local/ 7 /local/
8 /build/
9 8
10 #///////////////////////////////////////////////////////////////////////////// 9 #/////////////////////////////////////////////////////////////////////////////
11 # npm files 10 # npm files
......
1 {
2 "engine_version": "2.0.10",
3 "has_native": true,
4 "project_type": "js",
5 "projectName": "fuse_apk",
6 "packageName": "org.cocos2d.helloworld"
7 }
...\ No newline at end of file ...\ No newline at end of file
1 {
2 "do_default": {
3 "exclude_from_template": [
4 "frameworks/runtime-src"
5 ]
6 },
7 "do_add_native_support": {
8 "append_from_template": {
9 "from": "frameworks/runtime-src",
10 "to": "frameworks/runtime-src",
11 "exclude": [
12 "proj.ios_mac/HelloJavascript.xcodeproj/project.xcworkspace",
13 "proj.ios_mac/HelloJavascript.xcodeproj/xcuserdata",
14 "proj.win32/Debug.win32",
15 "proj.win32/Release.win32",
16 "proj.win32/HelloJavascript.sdf"
17 ]
18 },
19 "append_file": [{
20 "from": "cocos/scripting/js-bindings/manual/jsb_module_register.cpp",
21 "to": "frameworks/runtime-src/Classes/jsb_module_register.cpp"
22 }],
23 "project_rename": {
24 "src_project_name": "HelloJavascript",
25 "files": [
26 "frameworks/runtime-src/proj.win32/PROJECT_NAME.vcxproj",
27 "frameworks/runtime-src/proj.win32/PROJECT_NAME.vcxproj.filters",
28 "frameworks/runtime-src/proj.win32/PROJECT_NAME.vcxproj.user",
29 "frameworks/runtime-src/proj.win32/PROJECT_NAME.sln",
30 "frameworks/runtime-src/proj.ios_mac/PROJECT_NAME.xcodeproj"
31 ]
32 },
33 "project_replace_project_name": {
34 "src_project_name": "HelloJavascript",
35 "files": [
36 "frameworks/runtime-src/proj.win32/PROJECT_NAME.vcxproj",
37 "frameworks/runtime-src/proj.win32/PROJECT_NAME.vcxproj.filters",
38 "frameworks/runtime-src/proj.win32/PROJECT_NAME.vcxproj.user",
39 "frameworks/runtime-src/proj.win32/PROJECT_NAME.sln",
40 "frameworks/runtime-src/proj.win32/main.cpp",
41 "frameworks/runtime-src/proj.android-studio/settings.gradle",
42 "frameworks/runtime-src/proj.android-studio/app/res/values/strings.xml",
43 "frameworks/runtime-src/proj.ios_mac/ios/main.m",
44 "frameworks/runtime-src/proj.ios_mac/ios/Prefix.pch",
45 "frameworks/runtime-src/proj.ios_mac/PROJECT_NAME.xcodeproj/project.pbxproj",
46 "frameworks/runtime-src/Classes/AppDelegate.cpp"
47 ]
48 },
49 "project_replace_package_name": {
50 "src_package_name": "org.cocos2dx.hellojavascript",
51 "files": [
52 "frameworks/runtime-src/proj.android-studio/app/build.gradle",
53 "frameworks/runtime-src/proj.android-studio/app/AndroidManifest.xml"
54 ]
55 },
56 "project_replace_mac_bundleid": {
57 "src_bundle_id": "org.cocos2dx.hellojavascript",
58 "files": [
59 "frameworks/runtime-src/proj.ios_mac/mac/Info.plist"
60 ]
61 },
62 "project_replace_ios_bundleid": {
63 "src_bundle_id": "org.cocos2dx.hellojavascript",
64 "files": [
65 "frameworks/runtime-src/proj.ios_mac/ios/Info.plist"
66 ]
67 }
68 }
69 }
1 /****************************************************************************
2 Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
3
4 http://www.cocos.com
5
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated engine source code (the "Software"), a limited,
8 worldwide, royalty-free, non-assignable, revocable and non-exclusive license
9 to use Cocos Creator solely to develop games on your target platforms. You shall
10 not use Cocos Creator software for developing other software or tools that's
11 used for developing games. You are not granted to publish, distribute,
12 sublicense, and/or sell copies of Cocos Creator.
13
14 The software or tools in this License Agreement are licensed, not sold.
15 Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
16
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 THE SOFTWARE.
24 ****************************************************************************/
25
26 #include "AppDelegate.h"
27
28 #include "cocos2d.h"
29
30 #include "cocos/scripting/js-bindings/manual/jsb_module_register.hpp"
31 #include "cocos/scripting/js-bindings/manual/jsb_global.h"
32 #include "cocos/scripting/js-bindings/jswrapper/SeApi.h"
33 #include "cocos/scripting/js-bindings/event/EventDispatcher.h"
34 #include "cocos/scripting/js-bindings/manual/jsb_classtype.hpp"
35
36 USING_NS_CC;
37
38 AppDelegate::AppDelegate(int width, int height) : Application("Cocos Game", width, height)
39 {
40 }
41
42 AppDelegate::~AppDelegate()
43 {
44 }
45
46 bool AppDelegate::applicationDidFinishLaunching()
47 {
48 se::ScriptEngine *se = se::ScriptEngine::getInstance();
49
50 jsb_set_xxtea_key("0b7cbd8b-f258-42");
51 jsb_init_file_operation_delegate();
52
53 #if defined(COCOS2D_DEBUG) && (COCOS2D_DEBUG > 0)
54 // Enable debugger here
55 jsb_enable_debugger("0.0.0.0", 6086, false);
56 #endif
57
58 se->setExceptionCallback([](const char *location, const char *message, const char *stack) {
59 // Send exception information to server like Tencent Bugly.
60 });
61
62 jsb_register_all_modules();
63
64 se->start();
65
66 se::AutoHandleScope hs;
67 jsb_run_script("jsb-adapter/jsb-builtin.js");
68 jsb_run_script("main.js");
69
70 se->addAfterCleanupHook([]() {
71 JSBClassType::destroy();
72 });
73
74 return true;
75 }
76
77 // This function will be called when the app is inactive. When comes a phone call,it's be invoked too
78 void AppDelegate::applicationDidEnterBackground()
79 {
80 EventDispatcher::dispatchEnterBackgroundEvent();
81 }
82
83 // this function will be called when the app is active again
84 void AppDelegate::applicationWillEnterForeground()
85 {
86 EventDispatcher::dispatchEnterForegroundEvent();
87 }
1 /****************************************************************************
2 Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
3
4 http://www.cocos.com
5
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated engine source code (the "Software"), a limited,
8 worldwide, royalty-free, non-assignable, revocable and non-exclusive license
9 to use Cocos Creator solely to develop games on your target platforms. You shall
10 not use Cocos Creator software for developing other software or tools that's
11 used for developing games. You are not granted to publish, distribute,
12 sublicense, and/or sell copies of Cocos Creator.
13
14 The software or tools in this License Agreement are licensed, not sold.
15 Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
16
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 THE SOFTWARE.
24 ****************************************************************************/
25 #pragma once
26
27 #include "platform/CCApplication.h"
28 /**
29 @brief The cocos2d Application.
30
31 The reason for implement as private inheritance is to hide some interface call by Director.
32 */
33 class AppDelegate : public cocos2d::Application
34 {
35 public:
36 AppDelegate(int width, int height);
37 virtual ~AppDelegate();
38
39 /**
40 @brief Implement Director and Scene init code here.
41 @return true Initialize success, app continue.
42 @return false Initialize failed, app terminate.
43 */
44 virtual bool applicationDidFinishLaunching() override;
45
46 /**
47 @brief The function be called when the application enter background
48 @param the pointer of the application
49 */
50 virtual void applicationDidEnterBackground() override;
51
52 /**
53 @brief The function be called when the application enter foreground
54 @param the pointer of the application
55 */
56 virtual void applicationWillEnterForeground() override;
57 };
1 /****************************************************************************
2 Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
3
4 http://www.cocos.com
5
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated engine source code (the "Software"), a limited,
8 worldwide, royalty-free, non-assignable, revocable and non-exclusive license
9 to use Cocos Creator solely to develop games on your target platforms. You shall
10 not use Cocos Creator software for developing other software or tools that's
11 used for developing games. You are not granted to publish, distribute,
12 sublicense, and/or sell copies of Cocos Creator.
13
14 The software or tools in this License Agreement are licensed, not sold.
15 Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
16
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 THE SOFTWARE.
24 ****************************************************************************/
25
26 #include "cocos2d.h"
27
28 #include "cocos/scripting/js-bindings/manual/jsb_module_register.hpp"
29 #include "cocos/scripting/js-bindings/jswrapper/SeApi.h"
30
31 #include "cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.hpp"
32
33 #include "cocos/scripting/js-bindings/manual/jsb_global.h"
34 #include "cocos/scripting/js-bindings/manual/jsb_node.hpp"
35 #include "cocos/scripting/js-bindings/manual/jsb_conversions.hpp"
36 #include "cocos/scripting/js-bindings/manual/jsb_opengl_manual.hpp"
37 #include "cocos/scripting/js-bindings/manual/jsb_platform.h"
38 #include "cocos/scripting/js-bindings/manual/jsb_cocos2dx_manual.hpp"
39 #include "cocos/scripting/js-bindings/manual/jsb_xmlhttprequest.hpp"
40 #include "cocos/scripting/js-bindings/manual/jsb_cocos2dx_network_manual.h"
41 #include "cocos/scripting/js-bindings/auto/jsb_cocos2dx_network_auto.hpp"
42 #include "cocos/scripting/js-bindings/auto/jsb_cocos2dx_extension_auto.hpp"
43
44 #if USE_GFX_RENDERER
45 #include "cocos/scripting/js-bindings/auto/jsb_gfx_auto.hpp"
46 #include "cocos/scripting/js-bindings/auto/jsb_renderer_auto.hpp"
47 #include "cocos/scripting/js-bindings/manual/jsb_gfx_manual.hpp"
48 #include "cocos/scripting/js-bindings/manual/jsb_renderer_manual.hpp"
49 #endif
50
51 #if USE_SOCKET
52 #include "cocos/scripting/js-bindings/manual/jsb_websocket.hpp"
53 #include "cocos/scripting/js-bindings/manual/jsb_socketio.hpp"
54 #endif // USE_SOCKET
55
56 #if USE_AUDIO
57 #include "cocos/scripting/js-bindings/auto/jsb_cocos2dx_audioengine_auto.hpp"
58 #endif
59
60 #if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
61 #include "cocos/scripting/js-bindings/manual/JavaScriptObjCBridge.h"
62 #endif
63
64 #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
65 #include "cocos/scripting/js-bindings/manual/JavaScriptJavaBridge.h"
66 #endif
67
68 #if USE_MIDDLEWARE
69 #include "cocos/scripting/js-bindings/auto/jsb_cocos2dx_editor_support_auto.hpp"
70
71 #if USE_SPINE
72 #include "cocos/scripting/js-bindings/auto/jsb_cocos2dx_spine_auto.hpp"
73 #include "cocos/scripting/js-bindings/manual/jsb_spine_manual.hpp"
74 #endif
75
76 #if USE_DRAGONBONES
77 #include "cocos/scripting/js-bindings/auto/jsb_cocos2dx_dragonbones_auto.hpp"
78 #include "cocos/scripting/js-bindings/manual/jsb_dragonbones_manual.hpp"
79 #endif
80
81 #endif // USE_MIDDLEWARE
82
83 #if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
84
85 #if USE_VIDEO
86 #include "cocos/scripting/js-bindings/auto/jsb_video_auto.hpp"
87 #endif
88
89 #if USE_WEB_VIEW
90 #include "cocos/scripting/js-bindings/auto/jsb_webview_auto.hpp"
91 #endif
92
93 #endif // (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
94
95 using namespace cocos2d;
96
97 bool jsb_register_all_modules()
98 {
99 se::ScriptEngine* se = se::ScriptEngine::getInstance();
100
101 se->addBeforeInitHook([](){
102 JSBClassType::init();
103 });
104
105 se->addBeforeCleanupHook([se](){
106 se->garbageCollect();
107 PoolManager::getInstance()->getCurrentPool()->clear();
108 se->garbageCollect();
109 PoolManager::getInstance()->getCurrentPool()->clear();
110 });
111
112 se->addRegisterCallback(jsb_register_global_variables);
113 se->addRegisterCallback(JSB_register_opengl);
114 se->addRegisterCallback(register_all_engine);
115 se->addRegisterCallback(register_all_cocos2dx_manual);
116 se->addRegisterCallback(register_platform_bindings);
117
118 se->addRegisterCallback(register_all_network);
119 se->addRegisterCallback(register_all_cocos2dx_network_manual);
120 se->addRegisterCallback(register_all_xmlhttprequest);
121 // extension depend on network
122 se->addRegisterCallback(register_all_extension);
123
124 #if USE_GFX_RENDERER
125 se->addRegisterCallback(register_all_gfx);
126 se->addRegisterCallback(jsb_register_gfx_manual);
127 se->addRegisterCallback(register_all_renderer);
128 se->addRegisterCallback(jsb_register_renderer_manual);
129 #endif
130
131 #if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
132 se->addRegisterCallback(register_javascript_objc_bridge);
133 #endif
134
135 #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
136 se->addRegisterCallback(register_javascript_java_bridge);
137 #endif
138
139 #if USE_AUDIO
140 se->addRegisterCallback(register_all_audioengine);
141 #endif
142
143
144 #if USE_SOCKET
145 se->addRegisterCallback(register_all_websocket);
146 se->addRegisterCallback(register_all_socketio);
147 #endif
148
149 #if USE_MIDDLEWARE
150 se->addRegisterCallback(register_all_cocos2dx_editor_support);
151
152 #if USE_SPINE
153 se->addRegisterCallback(register_all_cocos2dx_spine);
154 se->addRegisterCallback(register_all_spine_manual);
155 #endif
156
157 #if USE_DRAGONBONES
158 se->addRegisterCallback(register_all_cocos2dx_dragonbones);
159 se->addRegisterCallback(register_all_dragonbones_manual);
160 #endif
161
162 #endif // USE_MIDDLEWARE
163
164 #if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
165
166 #if USE_VIDEO
167 se->addRegisterCallback(register_all_video);
168 #endif
169
170 #if USE_WEB_VIEW
171 se->addRegisterCallback(register_all_webview);
172 #endif
173
174 #endif // (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
175
176 se->addAfterCleanupHook([](){
177 PoolManager::getInstance()->getCurrentPool()->clear();
178 JSBClassType::destroy();
179 });
180 return true;
181 }
1 .gradle
2 /local.properties
3 /.idea/workspace.xml
4 /.idea/libraries
5 .DS_Store
6 /build
7 /captures
1 Executable : D:\Android\android-ndk-r16b\ndk-build.cmd
2 arguments :
3 NDK_PROJECT_PATH=null
4 APP_BUILD_SCRIPT=D:\LocalTopdrawSchool\build\jsb-link\frameworks\runtime-src\proj.android-studio\app\jni\Android.mk
5 NDK_APPLICATION_MK=D:\LocalTopdrawSchool\build\jsb-link\frameworks\runtime-src\proj.android-studio\app\jni\Application.mk
6 APP_ABI=armeabi-v7a
7 NDK_ALL_ABIS=armeabi-v7a
8 NDK_DEBUG=1
9 APP_PLATFORM=android-16
10 NDK_OUT=D:/LocalTopdrawSchool/build/jsb-link/frameworks/runtime-src/proj.android-studio/app/build/intermediates/ndkBuild/debug/obj
11 NDK_LIBS_OUT=D:\LocalTopdrawSchool\build\jsb-link\frameworks\runtime-src\proj.android-studio\app\build\intermediates\ndkBuild\debug\lib
12 NDK_TOOLCHAIN_VERSION=clang
13 NDK_MODULE_PATH=D:\CocosCreator_2.0.10\resources\cocos2d-x;D:\CocosCreator_2.0.10\resources\cocos2d-x\cocos;D:\CocosCreator_2.0.10\resources\cocos2d-x\external
14 -j4
15 NDK_DEBUG=1
16 APP_SHORT_COMMANDS=false
17 LOCAL_SHORT_COMMANDS=false
18 -B
19 -n
20 jvmArgs :
21
1 Executable : D:\Android\android-ndk-r16b\ndk-build.cmd
2 arguments :
3 NDK_PROJECT_PATH=null
4 APP_BUILD_SCRIPT=D:\LocalTopdrawSchool\build\jsb-link\frameworks\runtime-src\proj.android-studio\app\jni\Android.mk
5 NDK_APPLICATION_MK=D:\LocalTopdrawSchool\build\jsb-link\frameworks\runtime-src\proj.android-studio\app\jni\Application.mk
6 APP_ABI=armeabi-v7a
7 NDK_ALL_ABIS=armeabi-v7a
8 NDK_DEBUG=0
9 APP_PLATFORM=android-16
10 NDK_OUT=D:/LocalTopdrawSchool/build/jsb-link/frameworks/runtime-src/proj.android-studio/app/build/intermediates/ndkBuild/release/obj
11 NDK_LIBS_OUT=D:\LocalTopdrawSchool\build\jsb-link\frameworks\runtime-src\proj.android-studio\app\build\intermediates\ndkBuild\release\lib
12 NDK_TOOLCHAIN_VERSION=clang
13 NDK_MODULE_PATH=D:\CocosCreator_2.0.10\resources\cocos2d-x;D:\CocosCreator_2.0.10\resources\cocos2d-x\cocos;D:\CocosCreator_2.0.10\resources\cocos2d-x\external
14 -j4
15 NDK_DEBUG=0
16 APP_SHORT_COMMANDS=false
17 LOCAL_SHORT_COMMANDS=false
18 -B
19 -n
20 jvmArgs :
21
1 <?xml version="1.0" encoding="utf-8"?>
2 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3 package="org.cocos2d.helloworld"
4 android:installLocation="auto">
5
6 <uses-feature android:glEsVersion="0x00020000" />
7
8 <uses-permission android:name="android.permission.INTERNET"/>
9 <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
10 <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
11
12 <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
13 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
14
15 <uses-permission android:name="android.permission.GET_ACCOUNTS" />
16 <uses-permission android:name="android.permission.BLUETOOTH" />
17 <uses-permission android:name="android.permission.READ_PHONE_STATE" />
18 <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
19 <uses-permission android:name="android.permission.WAKE_LOCK" />
20 <uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
21
22
23 <application
24 android:allowBackup="true"
25 android:name="org.cocos2dx.javascript.MyApplication"
26 android:label="@string/app_name"
27 android:icon="@mipmap/ic_launcher">
28
29 <!-- Tell Cocos2dxActivity the name of our .so -->
30 <meta-data android:name="android.app.lib_name"
31 android:value="cocos2djs" />
32
33 <meta-data
34 android:name="APPID"
35 android:value="tdb0a830ea90662a91" />
36 <meta-data
37 android:name="APPSECRET"
38 android:value="6eabd05f50921a364b7643dfb1208452" />
39
40 <activity
41 android:name="com.topdraw.sdk.TopdrawActivity"
42 android:process=":plugin"
43 android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
44 <activity
45 android:name="org.cocos2dx.javascript.AppActivity"
46 android:screenOrientation="sensorLandscape"
47 android:configChanges="orientation|keyboardHidden|screenSize"
48 android:label="@string/app_name"
49 android:usesCleartextTraffic="true"
50 android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
51 android:launchMode="singleTask"
52 android:taskAffinity="" >
53 <intent-filter>
54 <action android:name="android.intent.action.MAIN" />
55
56 <category android:name="android.intent.category.LAUNCHER" />
57 </intent-filter>
58 </activity>
59 </application>
60
61 </manifest>
1 import org.apache.tools.ant.taskdefs.condition.Os
2
3 apply plugin: 'com.android.application'
4
5 android {
6 compileSdkVersion PROP_COMPILE_SDK_VERSION.toInteger()
7 buildToolsVersion PROP_BUILD_TOOLS_VERSION
8
9 defaultConfig {
10 applicationId "org.cocos2d.helloworld"
11 minSdkVersion PROP_MIN_SDK_VERSION
12 targetSdkVersion PROP_TARGET_SDK_VERSION
13 versionCode 1
14 versionName "1.0"
15
16 externalNativeBuild {
17 ndkBuild {
18 if (!project.hasProperty("PROP_NDK_MODE") || PROP_NDK_MODE.compareTo('none') != 0) {
19 // skip the NDK Build step if PROP_NDK_MODE is none
20 targets 'cocos2djs'
21 arguments 'NDK_TOOLCHAIN_VERSION=clang'
22
23 def module_paths = [project.file("D:/CocosCreator_2.0.10/resources/cocos2d-x"),
24 project.file("D:/CocosCreator_2.0.10/resources/cocos2d-x/cocos"),
25 project.file("D:/CocosCreator_2.0.10/resources/cocos2d-x/external")]
26 if (Os.isFamily(Os.FAMILY_WINDOWS)) {
27 arguments 'NDK_MODULE_PATH=' + module_paths.join(";")
28 }
29 else {
30 arguments 'NDK_MODULE_PATH=' + module_paths.join(':')
31 }
32
33 arguments '-j' + Runtime.runtime.availableProcessors()
34 abiFilters.addAll(PROP_APP_ABI.split(':').collect{it as String})
35 }
36 }
37 }
38 }
39
40 sourceSets.main {
41 java.srcDir "src"
42 res.srcDir "res"
43 jniLibs.srcDir "libs"
44 manifest.srcFile "AndroidManifest.xml"
45 }
46
47 externalNativeBuild {
48 ndkBuild {
49 if (!project.hasProperty("PROP_NDK_MODE") || PROP_NDK_MODE.compareTo('none') != 0) {
50 // skip the NDK Build step if PROP_NDK_MODE is none
51 path "jni/Android.mk"
52 }
53 }
54 }
55
56 signingConfigs {
57
58 release {
59 if (project.hasProperty("RELEASE_STORE_FILE")) {
60 storeFile file(RELEASE_STORE_FILE)
61 storePassword RELEASE_STORE_PASSWORD
62 keyAlias RELEASE_KEY_ALIAS
63 keyPassword RELEASE_KEY_PASSWORD
64 }
65 }
66 }
67
68 buildTypes {
69 release {
70 debuggable false
71 jniDebuggable false
72 renderscriptDebuggable false
73 minifyEnabled true
74 shrinkResources true
75 proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
76 if (project.hasProperty("RELEASE_STORE_FILE")) {
77 signingConfig signingConfigs.release
78 }
79
80 externalNativeBuild {
81 ndkBuild {
82 arguments 'NDK_DEBUG=0'
83 }
84 }
85 }
86
87 debug {
88 debuggable true
89 jniDebuggable true
90 renderscriptDebuggable true
91 externalNativeBuild {
92 ndkBuild {
93 arguments 'NDK_DEBUG=1'
94 }
95 }
96 }
97 }
98 }
99
100 android.applicationVariants.all { variant ->
101 // delete previous files first
102 delete "${buildDir}/intermediates/merged_assets/${variant.dirName}"
103
104 variant.mergeAssets.doLast {
105 def sourceDir = "${buildDir}/../../../../.."
106
107 copy {
108 from "${sourceDir}/res"
109 into "${outputDir}/res"
110 }
111
112 copy {
113 from "${sourceDir}/subpackages"
114 into "${outputDir}/subpackages"
115 }
116
117 copy {
118 from "${sourceDir}/src"
119 into "${outputDir}/src"
120 }
121
122 copy {
123 from "${sourceDir}/jsb-adapter"
124 into "${outputDir}/jsb-adapter"
125 }
126
127 copy {
128 from "${sourceDir}/main.js"
129 from "${sourceDir}/project.json"
130 into outputDir
131 }
132 }
133 }
134
135 dependencies {
136 implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
137 implementation fileTree(include: ['*.jar'], dir: 'D:/CocosCreator_2.0.10/resources/cocos2d-x/cocos/platform/android/java/libs')
138 implementation project(':libcocos2dx')
139 implementation files('libs/TopdrawSDK.jar')
140 }
1 LOCAL_PATH := $(call my-dir)
2
3 include $(CLEAR_VARS)
4
5 LOCAL_MODULE := cocos2djs_shared
6
7 LOCAL_MODULE_FILENAME := libcocos2djs
8
9 ifeq ($(USE_ARM_MODE),1)
10 LOCAL_ARM_MODE := arm
11 endif
12
13 LOCAL_SRC_FILES := hellojavascript/main.cpp \
14 ../../../Classes/AppDelegate.cpp \
15 ../../../Classes/jsb_module_register.cpp \
16
17 LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../Classes
18
19 LOCAL_STATIC_LIBRARIES := cocos2dx_static
20
21 include $(BUILD_SHARED_LIBRARY)
22
23 $(call import-module, cocos)
1 APP_STL := c++_static
2
3 # Uncomment this line to compile to armeabi-v7a, your application will run faster but support less devices
4 APP_ABI := armeabi-v7a
5
6 APP_CPPFLAGS := -frtti -std=c++11 -fsigned-char
7 APP_LDFLAGS := -latomic
8
9 # To solve windows commands char length too long
10 APP_SHORT_COMMANDS := true
11
12 USE_ARM_MODE := 1
13
14 # MUST be careful to modify this manually
15 # disable module will speed up compile time, and reduce package size
16 USE_GFX_RENDERER := 0
17 USE_VIDEO := 1
18 USE_WEB_VIEW := 1
19 USE_AUDIO := 1
20 USE_SOCKET := 1
21 USE_SPINE := 1
22 USE_DRAGONBONES := 1
23 USE_TIFF := 1
24 USE_MIDDLEWARE := 1
25
26 APP_CPPFLAGS += -DUSE_GFX_RENDERER=$(USE_GFX_RENDERER)
27 APP_CPPFLAGS += -DUSE_VIDEO=${USE_VIDEO}
28 APP_CPPFLAGS += -DUSE_WEB_VIEW=${USE_WEB_VIEW}
29 APP_CPPFLAGS += -DUSE_AUDIO=${USE_AUDIO}
30 APP_CPPFLAGS += -DUSE_SOCKET=${USE_SOCKET}
31 APP_CPPFLAGS += -DUSE_SPINE=${USE_SPINE}
32 APP_CPPFLAGS += -DUSE_DRAGONBONES=${USE_DRAGONBONES}
33 APP_CPPFLAGS += -DCC_USE_TIFF=${USE_TIFF}
34 APP_CPPFLAGS += -DUSE_MIDDLEWARE=${USE_MIDDLEWARE}
35
36 ifeq ($(NDK_DEBUG),1)
37 APP_CPPFLAGS += -DCOCOS2D_DEBUG=1
38 APP_CFLAGS += -DCOCOS2D_DEBUG=1
39 APP_OPTIM := debug
40 else
41 APP_CPPFLAGS += -DNDEBUG
42 APP_CFLAGS += -DNDEBUG
43 APP_OPTIM := release
44 endif
45
46 # Some Android Simulators don't support SSE instruction, so disable it for x86 arch.
47 APP_CPPFLAGS += -U__SSE__
48 USE_EDIT_BOX := 1
1 /****************************************************************************
2 Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
3
4 http://www.cocos.com
5
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated engine source code (the "Software"), a limited,
8 worldwide, royalty-free, non-assignable, revocable and non-exclusive license
9 to use Cocos Creator solely to develop games on your target platforms. You shall
10 not use Cocos Creator software for developing other software or tools that's
11 used for developing games. You are not granted to publish, distribute,
12 sublicense, and/or sell copies of Cocos Creator.
13
14 The software or tools in this License Agreement are licensed, not sold.
15 Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
16
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 THE SOFTWARE.
24 ****************************************************************************/
25
26 #include "AppDelegate.h"
27 #include "cocos2d.h"
28 #include "platform/android/jni/JniHelper.h"
29 #include <jni.h>
30 #include <android/log.h>
31
32 #define LOG_TAG "main"
33 #define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)
34 using namespace cocos2d;
35
36 //called when JNI_OnLoad()
37 void cocos_jni_env_init(JNIEnv *env)
38 {
39 LOGD("cocos_jni_env_init");
40 }
41
42 //called when onSurfaceCreated()
43 Application *cocos_android_app_init(JNIEnv *env, int width, int height)
44 {
45 LOGD("cocos_android_app_init");
46 auto app = new AppDelegate(width, height);
47 return app;
48 }
49
50 extern "C"
51 {
52 /*JNI_CALL_FUNCTION*/
53 }
1 sdk.dir=D:\\Android\\SDK
2 ndk.dir=D:\\Android\\android-ndk-r16b
1 # Add project specific ProGuard rules here.
2 # By default, the flags in this file are appended to flags specified
3 # in E:\developSoftware\Android\SDK/tools/proguard/proguard-android.txt
4 # You can edit the include path and order by changing the proguardFiles
5 # directive in build.gradle.
6 #
7 # For more details, see
8 # http://developer.android.com/guide/developing/tools/proguard.html
9
10 # Add any project specific keep options here:
11
12 # If your project uses WebView with JS, uncomment the following
13 # and specify the fully qualified class name to the JavaScript interface
14 # class:
15 #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 # public *;
17 #}
18
19 # Proguard Cocos2d-x-lite for release
20 -keep public class org.cocos2dx.** { *; }
21 -dontwarn org.cocos2dx.**
22
23 # Proguard Apache HTTP for release
24 -keep class org.apache.http.** { *; }
25 -dontwarn org.apache.http.**
26
27 # Proguard Android Webivew for release. you can comment if you are not using a webview
28 -keep public class android.net.http.SslError
29 -keep public class android.webkit.WebViewClient
30
31 -dontwarn android.webkit.WebView
32 -dontwarn android.net.http.SslError
33 -dontwarn android.webkit.WebViewClient
34
35 # keep anysdk for release. you can comment if you are not using anysdk
36 -keep public class com.anysdk.** { *; }
37 -dontwarn com.anysdk.**
1 # This file is automatically generated by Android Tools.
2 # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 #
4 # This file must be checked in Version Control Systems.
5 #
6 # To customize properties used by the Ant build system use,
7 # "ant.properties", and override values to adapt the script to your
8 # project structure.
9
10 # Project target.
11 target=android-29
1 <?xml version="1.0" encoding="utf-8"?>
2 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 android:layout_width="wrap_content"
4 android:layout_height="wrap_content">
5
6 <ProgressBar
7 android:id="@+id/pb_progress"
8 style="@android:style/Widget.ProgressBar.Horizontal"
9 android:layout_width="150dp"
10 android:layout_height="20dp"
11 android:layout_gravity="end|bottom"
12 android:layout_marginEnd="5dp"
13 android:layout_marginRight="5dp"
14 android:layout_marginBottom="20dp"
15 android:visibility="visible" />
16
17
18 </RelativeLayout>
...\ No newline at end of file ...\ No newline at end of file
1 <resources>
2 <string name="app_name" translatable="false">fuse_apk</string>
3 </resources>
1 /****************************************************************************
2 Copyright (c) 2015-2016 Chukong Technologies Inc.
3 Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
4
5 http://www.cocos2d-x.org
6
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software and associated documentation files (the "Software"), to deal
9 in the Software without restriction, including without limitation the rights
10 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 copies of the Software, and to permit persons to whom the Software is
12 furnished to do so, subject to the following conditions:
13
14 The above copyright notice and this permission notice shall be included in
15 all copies or substantial portions of the Software.
16
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 THE SOFTWARE.
24 ****************************************************************************/
25 package org.cocos2dx.javascript;
26
27 import org.cocos2d.helloworld.R;
28 import org.cocos2dx.lib.Cocos2dxActivity;
29 import org.cocos2dx.lib.Cocos2dxGLSurfaceView;
30
31 import android.content.ComponentName;
32 import android.os.Bundle;
33
34 import android.content.Intent;
35 import android.content.res.Configuration;
36 import android.util.Log;
37 import android.view.View;
38 import android.widget.ProgressBar;
39 import android.widget.Toast;
40
41 public class AppActivity extends Cocos2dxActivity {
42 private static final String TAG="AppActivity";
43 private static AppActivity _activity;
44 static ProgressBar pb_progress;
45 @Override
46 protected void onCreate(Bundle savedInstanceState) {
47 super.onCreate(savedInstanceState);
48 // setContentView(R.layout.activity_main);
49 pb_progress=findViewById(R.id.pb_progress);
50 _activity=this;
51 // Workaround in https://stackoverflow.com/questions/16283079/re-launch-of-activity-on-home-button-but-only-the-first-time/16447508
52 if (!isTaskRoot()) {
53 // Android launched another instance of the root activity into an existing task
54 // so just quietly finish and go away, dropping the user back into the activity
55 // at the top of the stack (ie: the last state of this task)
56 // Don't need to finish it again since it's finished in super.onCreate .
57 return;
58 }
59
60 TopdrawSDKWrapper.getInstance().init(this);
61 MyApplication.appActivity = this;
62
63 // DO OTHER INITIALIZATION BELOW
64 SDKWrapper.getInstance().init(this);
65 }
66
67 @Override
68 public Cocos2dxGLSurfaceView onCreateView() {
69 // Cocos2dxGLSurfaceView glSurfaceView = new Cocos2dxGLSurfaceView(this);
70 Cocos2dxGLSurfaceView glSurfaceView = super.onCreateView();
71 // TestCpp should create stencil buffer
72 // glSurfaceView.setEGLConfigChooser(5, 6, 5, 0, 16, 8);
73 glSurfaceView.setEGLConfigChooser(8, 8, 8, 8, 24, 8); //解决其他界面因为遮罩白屏的问题
74 SDKWrapper.getInstance().setGLSurfaceView(glSurfaceView, this);
75
76 return glSurfaceView;
77 }
78
79 @Override
80 protected void onResume() {
81 super.onResume();
82 SDKWrapper.getInstance().onResume();
83
84 }
85
86 @Override
87 protected void onPause() {
88 super.onPause();
89 SDKWrapper.getInstance().onPause();
90
91 }
92
93 @Override
94 protected void onDestroy() {
95 super.onDestroy();
96 SDKWrapper.getInstance().onDestroy();
97
98 }
99
100 @Override
101 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
102 super.onActivityResult(requestCode, resultCode, data);
103 SDKWrapper.getInstance().onActivityResult(requestCode, resultCode, data);
104 }
105
106 @Override
107 protected void onNewIntent(Intent intent) {
108 super.onNewIntent(intent);
109 SDKWrapper.getInstance().onNewIntent(intent);
110 }
111
112 @Override
113 protected void onRestart() {
114 super.onRestart();
115 SDKWrapper.getInstance().onRestart();
116 }
117
118 @Override
119 protected void onStop() {
120 super.onStop();
121 SDKWrapper.getInstance().onStop();
122 }
123
124 @Override
125 public void onBackPressed() {
126 SDKWrapper.getInstance().onBackPressed();
127 super.onBackPressed();
128 }
129
130 @Override
131 public void onConfigurationChanged(Configuration newConfig) {
132 SDKWrapper.getInstance().onConfigurationChanged(newConfig);
133 super.onConfigurationChanged(newConfig);
134 }
135
136 @Override
137 protected void onRestoreInstanceState(Bundle savedInstanceState) {
138 SDKWrapper.getInstance().onRestoreInstanceState(savedInstanceState);
139 super.onRestoreInstanceState(savedInstanceState);
140 }
141
142 @Override
143 protected void onSaveInstanceState(Bundle outState) {
144 SDKWrapper.getInstance().onSaveInstanceState(outState);
145 super.onSaveInstanceState(outState);
146 }
147
148 @Override
149 protected void onStart() {
150 SDKWrapper.getInstance().onStart();
151 super.onStart();
152 }
153
154 public static void startGame(int i,String apkName,final String strJSCallBack){
155 Log.d(TAG,"AppActivity starGame start..."+apkName);
156 // if (pluginLoaded) {
157 // return;
158 // }
159 // pluginLoaded = true;
160 // final String packageName = "com.topdraw.xhx";
161 // final String className = "org.cocos2dx.lua.AppActivity";
162 // PluginLoader.getInstance().start(packageName, new PluginLoader.OnResultListener() {
163 // @Override
164 // public void onResult(int i, final String msg) {
165 // if (0 == i) {
166 // try {
167 // Intent intent = new Intent();
168 // intent.setComponent(new ComponentName(packageName, className));
169 // intent.putExtra("path", msg);
170 // intent.putExtra("needNewProcess", true);
171 // intent.putExtra("needHook", true);
172 // _activity.startActivity(intent);
173 // pluginLoaded = false;
174 // } catch (Exception e) {
175 // e.printStackTrace();
176 // }
177 // } else if (-10 == i) {
178 // Toast.makeText(_activity, msg, Toast.LENGTH_LONG).show();
179 // pluginLoaded = false;
180 // } else {
181 // Log.d(TAG, "start plugin error | " + msg);
182 // }
183 // }
184 // },
185 // new PluginLoader.OnProgressListener() {
186 // @Override
187 // public void onProgress(final double d) {
188 // _activity.runOnUiThread(new Runnable() {
189 // @Override
190 // public void run() {
191 // int pg = Double.valueOf(d).intValue();
192 // if (100 == pg) {
193 // pb_progress.setVisibility(View.INVISIBLE);
194 // } else {
195 // if (View.INVISIBLE == pb_progress.getVisibility()) {
196 // pb_progress.setVisibility(View.VISIBLE);
197 // }
198 // }
199 // pb_progress.setProgress(pg);
200 // }
201 // });
202 // }
203 // });
204
205 }
206 }
1 package org.cocos2dx.javascript;
2
3 import android.content.Context;
4 import android.content.pm.PackageInfo;
5 import android.content.pm.PackageManager;
6 import android.os.Handler;
7 import android.util.Log;
8
9 import com.topdraw.sdk.ITopdrawResultListener;
10 import com.topdraw.sdk.ITopdrawSDK;
11 import com.topdraw.sdk.TopdrawApplication;
12 import com.topdraw.sdk.TopdrawSDK;
13
14 /**
15 * author : Jinwawa
16 * date : 2019/9/16 0016.
17 * desc :
18 */
19 public class MyApplication extends TopdrawApplication {
20 public static final String TAG="MyApplication";
21 private static String apiToken="Nothing";
22 private static Context context;
23 public static final String ROOT_DIR = "/mnt/sdcard/edu";
24 public static ITopdrawSDK topdrawSDK;
25 public static AppActivity appActivity;
26 public static String TOPDRAW_API_PATH="http://139.196.4.234:38080/hyperion.chimera";
27 private Handler mHandler=new Handler();
28
29 @Override
30 public void onCreate() {
31 super.onCreate();
32 this.context=this.getApplicationContext();
33 TopdrawSDK.init(context,initListener);
34
35 PluginLoader.getInstance().init(getApplicationContext(), mHandler, TOPDRAW_API_PATH, "/plugin/plugin.json");
36 }
37
38 public static Context getAppContext() { return context; }
39 /**
40 *初始化apk所使用的listener
41 */
42 private ITopdrawResultListener initListener = new ITopdrawResultListener() {
43 @Override
44 public void onResult(int i, String s, Object o) {
45 Log.d(TAG,"TopdrawSDK inited:["+i+"]"+s);
46
47
48 try {
49 PackageInfo packageInfo = context.getPackageManager()
50 .getPackageInfo(context.getPackageName(), PackageManager.GET_SIGNATURES);
51
52 byte[] hexBytes = packageInfo.signatures[0].toByteArray();
53
54 StringBuilder sb = new StringBuilder();
55
56 /*
57 for (int i1 = 0; i1 < hexBytes.length; i1++){
58 String str1=Integer.toHexString(hexBytes[i1] & 0xFF);
59 if (str1.length() == 1) {
60 str1 = '0' + str1;
61 }
62 sb.append(str1);
63
64 }
65 */
66 for (byte b : hexBytes) {
67 sb.append(String.format("%02x", b));
68 }
69
70
71 //Log.d(TAG,String.format("Signature:%s", sb.toString().trim()));
72
73 }catch(Exception ex){
74 ex.printStackTrace();
75 }
76
77 if(i == 0){
78 topdrawSDK = (ITopdrawSDK)o;
79 apiToken = topdrawSDK.getToken();
80 Log.d(TAG,"API Token: "+apiToken);
81 //topdrawSDK.auth(MelodyApplication.getAppContext(),apiToken,null,authListener);
82 }
83
84 }
85 };
86
87 }
1 /****************************************************************************
2 Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
3
4 http://www.cocos.com
5
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated engine source code (the "Software"), a limited,
8 worldwide, royalty-free, non-assignable, revocable and non-exclusive license
9 to use Cocos Creator solely to develop games on your target platforms. You shall
10 not use Cocos Creator software for developing other software or tools that's
11 used for developing games. You are not granted to publish, distribute,
12 sublicense, and/or sell copies of Cocos Creator.
13
14 The software or tools in this License Agreement are licensed, not sold.
15 Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
16
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 THE SOFTWARE.
24 ****************************************************************************/
25
26 package org.cocos2dx.javascript;
27
28 import android.content.Context;
29 import android.content.Intent;
30 import android.content.res.AssetManager;
31 import android.content.res.Configuration;
32 import android.opengl.GLSurfaceView;
33 import android.os.Bundle;
34 import org.cocos2dx.javascript.service.SDKClass;
35 import org.json.*;
36 import java.io.BufferedReader;
37 import java.io.IOException;
38 import java.io.InputStreamReader;
39 import java.util.ArrayList;
40 import java.util.List;
41
42 public class SDKWrapper {
43 private Context mainActive = null;
44 private static SDKWrapper mInstace = null;
45 private List<SDKClass> sdkClasses;
46
47 public static SDKWrapper getInstance() {
48 if (null == mInstace) {
49 mInstace = new SDKWrapper();
50 }
51 return mInstace;
52 }
53
54 public void init(Context context) {
55 this.mainActive = context;
56 for (SDKClass sdk : this.sdkClasses) {
57 sdk.init(context);
58 }
59 }
60
61 public Context getContext() {
62 return this.mainActive;
63 }
64
65 public void loadSDKClass() {
66 ArrayList<SDKClass> classes = new ArrayList<SDKClass>();
67 try {
68 String json = this.getJson(this.mainActive, "project.json");
69 JSONObject jsonObject = new JSONObject(json);
70 JSONArray serviceClassPath = jsonObject.getJSONArray("serviceClassPath");
71 if (serviceClassPath == null) return;
72 int length = serviceClassPath.length();
73 for (int i = 0; i < length; i++) {
74 String classPath = serviceClassPath.getString(i);
75 SDKClass sdk = (SDKClass) Class.forName(classPath).newInstance();
76 classes.add(sdk);
77 }
78 } catch (Exception e) {
79 e.printStackTrace();
80 }
81 this.sdkClasses = classes;
82 }
83
84 private String getJson(Context mContext, String fileName) {
85 StringBuilder sb = new StringBuilder();
86 AssetManager am = mContext.getAssets();
87 try {
88 BufferedReader br = new BufferedReader(new InputStreamReader(am.open(fileName)));
89 String next = "";
90 while (null != (next = br.readLine())) {
91 sb.append(next);
92 }
93 } catch (IOException e) {
94 e.printStackTrace();
95 sb.delete(0, sb.length());
96 }
97 return sb.toString().trim();
98 }
99
100 public void setGLSurfaceView(GLSurfaceView view, Context context) {
101 this.mainActive = context;
102 this.loadSDKClass();
103 for (SDKClass sdk : this.sdkClasses) {
104 sdk.setGLSurfaceView(view);
105 }
106 }
107
108 public void onResume() {
109 for (SDKClass sdk : this.sdkClasses) {
110 sdk.onResume();
111 }
112 }
113
114 public void onPause() {
115 for (SDKClass sdk : this.sdkClasses) {
116 sdk.onPause();
117 }
118 }
119
120 public void onDestroy() {
121 for (SDKClass sdk : this.sdkClasses) {
122 sdk.onDestroy();
123 }
124 }
125
126 public void onActivityResult(int requestCode, int resultCode, Intent data) {
127 for (SDKClass sdk : this.sdkClasses) {
128 sdk.onActivityResult(requestCode, resultCode, data);
129 }
130 }
131
132 public void onNewIntent(Intent intent) {
133 for (SDKClass sdk : this.sdkClasses) {
134 sdk.onNewIntent(intent);
135 }
136 }
137
138 public void onRestart() {
139 for (SDKClass sdk : this.sdkClasses) {
140 sdk.onRestart();
141 }
142 }
143
144 public void onStop() {
145 for (SDKClass sdk : this.sdkClasses) {
146 sdk.onStop();
147 }
148 }
149
150 public void onBackPressed() {
151 for (SDKClass sdk : this.sdkClasses) {
152 sdk.onBackPressed();
153 }
154 }
155
156 public void onConfigurationChanged(Configuration newConfig) {
157 for (SDKClass sdk : this.sdkClasses) {
158 sdk.onConfigurationChanged(newConfig);
159 }
160 }
161
162 public void onRestoreInstanceState(Bundle savedInstanceState) {
163 for (SDKClass sdk : this.sdkClasses) {
164 sdk.onRestoreInstanceState(savedInstanceState);
165 }
166 }
167
168 public void onSaveInstanceState(Bundle outState) {
169 for (SDKClass sdk : this.sdkClasses) {
170 sdk.onSaveInstanceState(outState);
171 }
172 }
173
174 public void onStart() {
175 for (SDKClass sdk : this.sdkClasses) {
176 sdk.onStart();
177 }
178 }
179 }
1 package org.cocos2dx.javascript;
2
3 import android.content.ComponentName;
4 import android.content.Context;
5 import android.content.Intent;
6 import android.util.Log;
7 import android.view.LayoutInflater;
8 import android.view.View;
9 import android.widget.ProgressBar;
10 import android.widget.Toast;
11
12 import org.cocos2d.helloworld.R;
13
14 import static android.webkit.ConsoleMessage.MessageLevel.LOG;
15
16 /**
17 * author : Jinwawa
18 * date : 2019/9/16 0016.
19 * desc :
20 */
21 public class TopdrawSDKWrapper {
22 private static final String TAG="TopdrawSDKWrapper";
23 private static AppActivity _activity;
24 private static TopdrawSDKWrapper _instance=null;
25 static ProgressBar pb_progress;
26 static boolean pluginLoaded=false;
27
28 private TopdrawSDKWrapper(){
29 }
30
31 public static TopdrawSDKWrapper getInstance(){
32 if (null==_instance){
33 try{
34 synchronized (TopdrawSDKWrapper.class) {
35 _instance=new TopdrawSDKWrapper();
36 }
37 }catch(Exception e){
38 e.printStackTrace();
39 }
40 }
41 return _instance;
42 }
43
44 public static void init(Context context) {
45 TopdrawSDKWrapper._activity=(AppActivity)context;
46 }
47
48 public static void startGame(int i,String apkName,final String strJSCallBack){
49 Log.d(TAG,"TopdrawSDKWrapper starGame start..."+apkName);
50
51 View view= LayoutInflater.from(_activity).inflate(R.layout.activity_main,null);
52 pb_progress=view.findViewById(R.id.pb_progress);
53 if (pluginLoaded) {
54 return;
55 }
56 pluginLoaded = true;
57 final String packageName = apkName;
58 final String className = "org.cocos2dx.lua.AppActivity";
59 PluginLoader.getInstance().start(packageName, new PluginLoader.OnResultListener() {
60 @Override
61 public void onResult(int i, final String msg) {
62 if (0 == i) {
63 try {
64 Intent intent = new Intent();
65 intent.setComponent(new ComponentName(packageName, className));
66 intent.putExtra("path", msg);
67 intent.putExtra("needNewProcess", true);
68 intent.putExtra("needHook", true);
69 _activity.startActivity(intent);
70 pluginLoaded = false;
71 } catch (Exception e) {
72 e.printStackTrace();
73 }
74 } else if (-10 == i) {
75 Toast.makeText(_activity, msg, Toast.LENGTH_LONG).show();
76 pluginLoaded = false;
77 } else {
78 // LOG(TAG, "start plugin error | " + msg);
79 }
80 }
81 },
82 new PluginLoader.OnProgressListener() {
83 @Override
84 public void onProgress(final double d) {
85 _activity.runOnUiThread(new Runnable() {
86 @Override
87 public void run() {
88 int pg = Double.valueOf(d).intValue();
89 if (100 == pg) {
90 pb_progress.setVisibility(View.INVISIBLE);
91 } else {
92 if (View.INVISIBLE == pb_progress.getVisibility()) {
93 pb_progress.setVisibility(View.VISIBLE);
94 }
95 }
96 pb_progress.setProgress(pg);
97 }
98 });
99 }
100 });
101 }
102 }
1 package org.cocos2dx.javascript.service;
2
3 import android.content.Context;
4 import android.content.Intent;
5 import android.content.res.Configuration;
6 import android.opengl.GLSurfaceView;
7 import android.os.Bundle;
8
9 public abstract class SDKClass implements SDKInterface {
10 private Context mainActive = null;
11 public Context getContext(){ return mainActive;}
12 @Override
13 public void init(Context context){ this.mainActive = context; }
14 @Override
15 public void setGLSurfaceView(GLSurfaceView view){}
16 @Override
17 public void onResume(){}
18 @Override
19 public void onPause(){}
20 @Override
21 public void onDestroy(){}
22 @Override
23 public void onActivityResult(int requestCode, int resultCode, Intent data){}
24 @Override
25 public void onNewIntent(Intent intent){}
26 @Override
27 public void onRestart(){}
28 @Override
29 public void onStop(){}
30 @Override
31 public void onBackPressed(){}
32 @Override
33 public void onConfigurationChanged(Configuration newConfig){}
34 @Override
35 public void onRestoreInstanceState(Bundle savedInstanceState){}
36 @Override
37 public void onSaveInstanceState(Bundle outState){}
38 @Override
39 public void onStart(){}
40 }
1 package org.cocos2dx.javascript.service;
2
3 import android.content.Context;
4 import android.content.Intent;
5 import android.content.res.Configuration;
6 import android.opengl.GLSurfaceView;
7 import android.os.Bundle;
8
9 public interface SDKInterface {
10 void init(Context context);
11 void setGLSurfaceView(GLSurfaceView view);
12 void onResume();
13 void onPause();
14 void onDestroy();
15 void onActivityResult(int requestCode, int resultCode, Intent data);
16 void onNewIntent(Intent intent);
17 void onRestart();
18 void onStop();
19 void onBackPressed();
20 void onConfigurationChanged(Configuration newConfig);
21 void onRestoreInstanceState(Bundle savedInstanceState);
22 void onSaveInstanceState(Bundle outState);
23 void onStart();
24 }
...\ No newline at end of file ...\ No newline at end of file
1 {
2 "ndk_module_path" :[
3 "D:/CocosCreator_2.0.10/resources/cocos2d-x",
4 "D:/CocosCreator_2.0.10/resources/cocos2d-x/cocos",
5 "D:/CocosCreator_2.0.10/resources/cocos2d-x/external"
6 ],
7 "copy_resources": []
8 }
1 // Top-level build file where you can add configuration options common to all sub-projects/modules.
2
3 buildscript {
4
5 repositories {
6 google()
7 jcenter()
8 }
9 dependencies {
10 classpath 'com.android.tools.build:gradle:3.2.0'
11
12
13 // NOTE: Do not place your application dependencies here; they belong
14 // in the individual module build.gradle files
15 }
16 }
17
18 allprojects {
19 repositories {
20 google()
21 jcenter()
22 flatDir {
23 dirs 'libs'
24 }
25 }
26 }
27
28 task clean(type: Delete) {
29 delete rootProject.buildDir
30 }
1 # Project-wide Gradle settings.
2
3 # IDE (e.g. Android Studio) users:
4 # Gradle settings configured through the IDE *will override*
5 # any settings specified in this file.
6
7 # For more details on how to configure your build environment visit
8 # http://www.gradle.org/docs/current/userguide/build_environment.html
9
10 # Specifies the JVM arguments used for the daemon process.
11 # The setting is particularly useful for tweaking memory settings.
12 # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14
15 # When configured, Gradle will run in incubating parallel mode.
16 # This option should only be used with decoupled projects. More details, visit
17 # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 # org.gradle.parallel=true
19
20 # Android SDK version that will be used as the compile project
21 PROP_COMPILE_SDK_VERSION=29
22
23 # Android SDK version that will be used as the earliest version of android this application can run on
24 PROP_MIN_SDK_VERSION=16
25
26 # Android SDK version that will be used as the latest version of android this application has been tested on
27 PROP_TARGET_SDK_VERSION=29
28
29 # Android Build Tools version that will be used as the compile project
30 PROP_BUILD_TOOLS_VERSION=28.0.3
31
32 # List of CPU Archtexture to build that application with
33 # Available architextures (armeabi-v7a | arm64-v8a | x86)
34 # To build for multiple architexture, use the `:` between them
35 # Example - PROP_APP_ABI=armeabi-v7a
36 PROP_APP_ABI=armeabi-v7a
37
38 # fill in sign information for release mode
39 RELEASE_STORE_FILE=D:/CocosCreator_2.0.10/resources/static/build-templates/native/debug.keystore
40 RELEASE_STORE_PASSWORD=123456
41 RELEASE_KEY_ALIAS=debug_keystore
42 RELEASE_KEY_PASSWORD=123456
1 #Fri Oct 27 10:18:28 CST 2017
2 distributionBase=GRADLE_USER_HOME
3 distributionPath=wrapper/dists
4 zipStoreBase=GRADLE_USER_HOME
5 zipStorePath=wrapper/dists
6 distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-all.zip
1 #!/usr/bin/env bash
2
3 ##############################################################################
4 ##
5 ## Gradle start up script for UN*X
6 ##
7 ##############################################################################
8
9 # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 DEFAULT_JVM_OPTS=""
11
12 APP_NAME="Gradle"
13 APP_BASE_NAME=`basename "$0"`
14
15 # Use the maximum available, or set MAX_FD != -1 to use that value.
16 MAX_FD="maximum"
17
18 warn ( ) {
19 echo "$*"
20 }
21
22 die ( ) {
23 echo
24 echo "$*"
25 echo
26 exit 1
27 }
28
29 # OS specific support (must be 'true' or 'false').
30 cygwin=false
31 msys=false
32 darwin=false
33 case "`uname`" in
34 CYGWIN* )
35 cygwin=true
36 ;;
37 Darwin* )
38 darwin=true
39 ;;
40 MINGW* )
41 msys=true
42 ;;
43 esac
44
45 # For Cygwin, ensure paths are in UNIX format before anything is touched.
46 if $cygwin ; then
47 [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48 fi
49
50 # Attempt to set APP_HOME
51 # Resolve links: $0 may be a link
52 PRG="$0"
53 # Need this for relative symlinks.
54 while [ -h "$PRG" ] ; do
55 ls=`ls -ld "$PRG"`
56 link=`expr "$ls" : '.*-> \(.*\)$'`
57 if expr "$link" : '/.*' > /dev/null; then
58 PRG="$link"
59 else
60 PRG=`dirname "$PRG"`"/$link"
61 fi
62 done
63 SAVED="`pwd`"
64 cd "`dirname \"$PRG\"`/" >&-
65 APP_HOME="`pwd -P`"
66 cd "$SAVED" >&-
67
68 CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
69
70 # Determine the Java command to use to start the JVM.
71 if [ -n "$JAVA_HOME" ] ; then
72 if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
73 # IBM's JDK on AIX uses strange locations for the executables
74 JAVACMD="$JAVA_HOME/jre/sh/java"
75 else
76 JAVACMD="$JAVA_HOME/bin/java"
77 fi
78 if [ ! -x "$JAVACMD" ] ; then
79 die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
80
81 Please set the JAVA_HOME variable in your environment to match the
82 location of your Java installation."
83 fi
84 else
85 JAVACMD="java"
86 which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
87
88 Please set the JAVA_HOME variable in your environment to match the
89 location of your Java installation."
90 fi
91
92 # Increase the maximum file descriptors if we can.
93 if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
94 MAX_FD_LIMIT=`ulimit -H -n`
95 if [ $? -eq 0 ] ; then
96 if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
97 MAX_FD="$MAX_FD_LIMIT"
98 fi
99 ulimit -n $MAX_FD
100 if [ $? -ne 0 ] ; then
101 warn "Could not set maximum file descriptor limit: $MAX_FD"
102 fi
103 else
104 warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
105 fi
106 fi
107
108 # For Darwin, add options to specify how the application appears in the dock
109 if $darwin; then
110 GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
111 fi
112
113 # For Cygwin, switch paths to Windows format before running java
114 if $cygwin ; then
115 APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116 CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
117
118 # We build the pattern for arguments to be converted via cygpath
119 ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 SEP=""
121 for dir in $ROOTDIRSRAW ; do
122 ROOTDIRS="$ROOTDIRS$SEP$dir"
123 SEP="|"
124 done
125 OURCYGPATTERN="(^($ROOTDIRS))"
126 # Add a user-defined pattern to the cygpath arguments
127 if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 fi
130 # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 i=0
132 for arg in "$@" ; do
133 CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135
136 if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 else
139 eval `echo args$i`="\"$arg\""
140 fi
141 i=$((i+1))
142 done
143 case $i in
144 (0) set -- ;;
145 (1) set -- "$args0" ;;
146 (2) set -- "$args0" "$args1" ;;
147 (3) set -- "$args0" "$args1" "$args2" ;;
148 (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 esac
155 fi
156
157 # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158 function splitJvmOpts() {
159 JVM_OPTS=("$@")
160 }
161 eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163
164 exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
1 @if "%DEBUG%" == "" @echo off
2 @rem ##########################################################################
3 @rem
4 @rem Gradle startup script for Windows
5 @rem
6 @rem ##########################################################################
7
8 @rem Set local scope for the variables with windows NT shell
9 if "%OS%"=="Windows_NT" setlocal
10
11 @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 set DEFAULT_JVM_OPTS=
13
14 set DIRNAME=%~dp0
15 if "%DIRNAME%" == "" set DIRNAME=.
16 set APP_BASE_NAME=%~n0
17 set APP_HOME=%DIRNAME%
18
19 @rem Find java.exe
20 if defined JAVA_HOME goto findJavaFromJavaHome
21
22 set JAVA_EXE=java.exe
23 %JAVA_EXE% -version >NUL 2>&1
24 if "%ERRORLEVEL%" == "0" goto init
25
26 echo.
27 echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 echo.
29 echo Please set the JAVA_HOME variable in your environment to match the
30 echo location of your Java installation.
31
32 goto fail
33
34 :findJavaFromJavaHome
35 set JAVA_HOME=%JAVA_HOME:"=%
36 set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37
38 if exist "%JAVA_EXE%" goto init
39
40 echo.
41 echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 echo.
43 echo Please set the JAVA_HOME variable in your environment to match the
44 echo location of your Java installation.
45
46 goto fail
47
48 :init
49 @rem Get command-line arguments, handling Windowz variants
50
51 if not "%OS%" == "Windows_NT" goto win9xME_args
52 if "%@eval[2+2]" == "4" goto 4NT_args
53
54 :win9xME_args
55 @rem Slurp the command line arguments.
56 set CMD_LINE_ARGS=
57 set _SKIP=2
58
59 :win9xME_args_slurp
60 if "x%~1" == "x" goto execute
61
62 set CMD_LINE_ARGS=%*
63 goto execute
64
65 :4NT_args
66 @rem Get arguments from the 4NT Shell from JP Software
67 set CMD_LINE_ARGS=%$
68
69 :execute
70 @rem Setup the command line
71
72 set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73
74 @rem Execute Gradle
75 "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76
77 :end
78 @rem End local scope for the variables with windows NT shell
79 if "%ERRORLEVEL%"=="0" goto mainEnd
80
81 :fail
82 rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 rem the _cmd.exe /c_ return code!
84 if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 exit /b 1
86
87 :mainEnd
88 if "%OS%"=="Windows_NT" endlocal
89
90 :omega
1 <?xml version="1.0" encoding="UTF-8"?>
2 <module external.linked.project.id="proj.android-studio" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
3 <component name="FacetManager">
4 <facet type="java-gradle" name="Java-Gradle">
5 <configuration>
6 <option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
7 <option name="BUILDABLE" value="false" />
8 </configuration>
9 </facet>
10 </component>
11 <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="true">
12 <exclude-output />
13 <content url="file://$MODULE_DIR$">
14 <excludeFolder url="file://$MODULE_DIR$/.gradle" />
15 </content>
16 <orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
17 <orderEntry type="sourceFolder" forTests="false" />
18 </component>
19 </module>
...\ No newline at end of file ...\ No newline at end of file
1 include ':libcocos2dx'
2 project(':libcocos2dx').projectDir = new File('D:/CocosCreator_2.0.10/resources/cocos2d-x/cocos/platform/android/libcocos2dx')
3 include ':fuse_apk'
4 project(':fuse_apk').projectDir = new File(settingsDir, 'app')
1 /****************************************************************************
2 Copyright (c) 2010-2013 cocos2d-x.org
3 Copyright (c) 2013-2016 Chukong Technologies Inc.
4 Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
5
6 http://www.cocos2d-x.org
7
8 Permission is hereby granted, free of charge, to any person obtaining a copy
9 of this software and associated documentation files (the "Software"), to deal
10 in the Software without restriction, including without limitation the rights
11 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 copies of the Software, and to permit persons to whom the Software is
13 furnished to do so, subject to the following conditions:
14
15 The above copyright notice and this permission notice shall be included in
16 all copies or substantial portions of the Software.
17
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 THE SOFTWARE.
25 ****************************************************************************/
26 #import <UIKit/UIKit.h>
27
28 @class RootViewController;
29
30 @interface AppController : NSObject <UIApplicationDelegate>
31 {
32 }
33
34 @property(nonatomic, readonly) RootViewController* viewController;
35
36 @end
37
1 /****************************************************************************
2 Copyright (c) 2010-2013 cocos2d-x.org
3 Copyright (c) 2013-2016 Chukong Technologies Inc.
4 Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
5
6 http://www.cocos2d-x.org
7
8 Permission is hereby granted, free of charge, to any person obtaining a copy
9 of this software and associated documentation files (the "Software"), to deal
10 in the Software without restriction, including without limitation the rights
11 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 copies of the Software, and to permit persons to whom the Software is
13 furnished to do so, subject to the following conditions:
14
15 The above copyright notice and this permission notice shall be included in
16 all copies or substantial portions of the Software.
17
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 THE SOFTWARE.
25 ****************************************************************************/
26
27 #import "AppController.h"
28 #import "cocos2d.h"
29 #import "AppDelegate.h"
30 #import "RootViewController.h"
31 #import "SDKWrapper.h"
32 #import "platform/ios/CCEAGLView-ios.h"
33
34
35
36 using namespace cocos2d;
37
38 @implementation AppController
39
40 Application* app = nullptr;
41 @synthesize window;
42
43 #pragma mark -
44 #pragma mark Application lifecycle
45
46 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
47 [[SDKWrapper getInstance] application:application didFinishLaunchingWithOptions:launchOptions];
48 // Add the view controller's view to the window and display.
49 float scale = [[UIScreen mainScreen] scale];
50 CGRect bounds = [[UIScreen mainScreen] bounds];
51 window = [[UIWindow alloc] initWithFrame: bounds];
52
53 // cocos2d application instance
54 app = new AppDelegate(bounds.size.width * scale, bounds.size.height * scale);
55 app->setMultitouch(true);
56
57 // Use RootViewController to manage CCEAGLView
58 _viewController = [[RootViewController alloc]init];
59 #ifdef NSFoundationVersionNumber_iOS_7_0
60 _viewController.automaticallyAdjustsScrollViewInsets = NO;
61 _viewController.extendedLayoutIncludesOpaqueBars = NO;
62 _viewController.edgesForExtendedLayout = UIRectEdgeAll;
63 #else
64 _viewController.wantsFullScreenLayout = YES;
65 #endif
66 // Set RootViewController to window
67 if ( [[UIDevice currentDevice].systemVersion floatValue] < 6.0)
68 {
69 // warning: addSubView doesn't work on iOS6
70 [window addSubview: _viewController.view];
71 }
72 else
73 {
74 // use this method on ios6
75 [window setRootViewController:_viewController];
76 }
77
78 [window makeKeyAndVisible];
79
80 [[UIApplication sharedApplication] setStatusBarHidden:YES];
81
82 //run the cocos2d-x game scene
83 app->start();
84
85 return YES;
86 }
87
88 - (void)applicationWillResignActive:(UIApplication *)application {
89 /*
90 Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
91 Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
92 */
93 [[SDKWrapper getInstance] applicationWillResignActive:application];
94 }
95
96 - (void)applicationDidBecomeActive:(UIApplication *)application {
97 /*
98 Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
99 */
100 [[SDKWrapper getInstance] applicationDidBecomeActive:application];
101 }
102
103 - (void)applicationDidEnterBackground:(UIApplication *)application {
104 /*
105 Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
106 If your application supports background execution, called instead of applicationWillTerminate: when the user quits.
107 */
108 [[SDKWrapper getInstance] applicationDidEnterBackground:application];
109 app->applicationDidEnterBackground();
110
111 }
112
113 - (void)applicationWillEnterForeground:(UIApplication *)application {
114 /*
115 Called as part of transition from the background to the inactive state: here you can undo many of the changes made on entering the background.
116 */
117 [[SDKWrapper getInstance] applicationWillEnterForeground:application];
118 app->applicationWillEnterForeground();
119
120 }
121
122 - (void)applicationWillTerminate:(UIApplication *)application
123 {
124 [[SDKWrapper getInstance] applicationWillTerminate:application];
125 delete app;
126 app = nil;
127 }
128
129
130 #pragma mark -
131 #pragma mark Memory management
132
133 - (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {
134 /*
135 Free up as much memory as possible by purging cached data objects that can be recreated (or reloaded from disk) later.
136 */
137 }
138
139 @end
1 <?xml version="1.0" encoding="UTF-8"?>
2 <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13196" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
3 <device id="retina5_9" orientation="landscape">
4 <adaptation id="fullscreen"/>
5 </device>
6 <dependencies>
7 <deployment version="1792" identifier="iOS"/>
8 <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13173"/>
9 <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
10 </dependencies>
11 <scenes>
12 <!--View Controller-->
13 <scene sceneID="EHf-IW-A2E">
14 <objects>
15 <viewController id="01J-lp-oVM" sceneMemberID="viewController">
16 <layoutGuides>
17 <viewControllerLayoutGuide type="top" id="fm7-M6-edp"/>
18 <viewControllerLayoutGuide type="bottom" id="uRH-d6-mvd"/>
19 </layoutGuides>
20 <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
21 <rect key="frame" x="0.0" y="0.0" width="812" height="375"/>
22 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
23 <subviews>
24 <imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleAspectFill" insetsLayoutMarginsFromSafeArea="NO" image="LaunchScreenBackground.png" translatesAutoresizingMaskIntoConstraints="NO" id="YCC-wj-Gww" userLabel="Background">
25 <rect key="frame" x="0.0" y="0.0" width="812" height="375"/>
26 </imageView>
27 </subviews>
28 <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
29 <constraints>
30 <constraint firstAttribute="bottom" secondItem="YCC-wj-Gww" secondAttribute="bottom" id="Naz-ae-jWI"/>
31 <constraint firstAttribute="trailing" secondItem="YCC-wj-Gww" secondAttribute="trailing" id="myj-85-hk9"/>
32 <constraint firstItem="YCC-wj-Gww" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leading" id="qOq-Cg-doS"/>
33 <constraint firstItem="YCC-wj-Gww" firstAttribute="top" secondItem="Ze5-6b-2t3" secondAttribute="top" id="xL7-Fo-4bl"/>
34 </constraints>
35 </view>
36 </viewController>
37 <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
38 </objects>
39 <point key="canvasLocation" x="50.399999999999999" y="373.15270935960592"/>
40 </scene>
41 </scenes>
42 <resources>
43 <image name="LaunchScreenBackground.png" width="2208" height="1242"/>
44 </resources>
45 </document>
1 /*
2 Localizable.strings
3 */
4
5 "done" = "Done";
6 "next" = "Next";
7 "search" = "Search";
8 "go" = "Go";
9 "send" = "Send";
1 {
2 "images" : [
3 {
4 "size" : "20x20",
5 "idiom" : "iphone",
6 "filename" : "Icon-20@2x.png",
7 "scale" : "2x"
8 },
9 {
10 "size" : "20x20",
11 "idiom" : "iphone",
12 "filename" : "Icon-20@3x.png",
13 "scale" : "3x"
14 },
15 {
16 "size" : "29x29",
17 "idiom" : "iphone",
18 "filename" : "Icon-29.png",
19 "scale" : "1x"
20 },
21 {
22 "size" : "29x29",
23 "idiom" : "iphone",
24 "filename" : "Icon-29@2x.png",
25 "scale" : "2x"
26 },
27 {
28 "size" : "29x29",
29 "idiom" : "iphone",
30 "filename" : "Icon-29@3x.png",
31 "scale" : "3x"
32 },
33 {
34 "size" : "40x40",
35 "idiom" : "iphone",
36 "filename" : "Icon-40@2x.png",
37 "scale" : "2x"
38 },
39 {
40 "size" : "40x40",
41 "idiom" : "iphone",
42 "filename" : "Icon-40@3x.png",
43 "scale" : "3x"
44 },
45 {
46 "size" : "57x57",
47 "idiom" : "iphone",
48 "filename" : "Icon-57.png",
49 "scale" : "1x"
50 },
51 {
52 "size" : "57x57",
53 "idiom" : "iphone",
54 "filename" : "Icon-57@2x.png",
55 "scale" : "2x"
56 },
57 {
58 "size" : "60x60",
59 "idiom" : "iphone",
60 "filename" : "Icon-60@2x.png",
61 "scale" : "2x"
62 },
63 {
64 "size" : "60x60",
65 "idiom" : "iphone",
66 "filename" : "Icon-60@3x.png",
67 "scale" : "3x"
68 },
69 {
70 "size" : "20x20",
71 "idiom" : "ipad",
72 "filename" : "Icon-20.png",
73 "scale" : "1x"
74 },
75 {
76 "size" : "20x20",
77 "idiom" : "ipad",
78 "filename" : "Icon-20@2x.png",
79 "scale" : "2x"
80 },
81 {
82 "size" : "29x29",
83 "idiom" : "ipad",
84 "filename" : "Icon-29.png",
85 "scale" : "1x"
86 },
87 {
88 "size" : "29x29",
89 "idiom" : "ipad",
90 "filename" : "Icon-29@2x.png",
91 "scale" : "2x"
92 },
93 {
94 "size" : "40x40",
95 "idiom" : "ipad",
96 "filename" : "Icon-40.png",
97 "scale" : "1x"
98 },
99 {
100 "size" : "40x40",
101 "idiom" : "ipad",
102 "filename" : "Icon-40@2x.png",
103 "scale" : "2x"
104 },
105 {
106 "size" : "50x50",
107 "idiom" : "ipad",
108 "filename" : "Icon-50.png",
109 "scale" : "1x"
110 },
111 {
112 "size" : "50x50",
113 "idiom" : "ipad",
114 "filename" : "Icon-50@2x.png",
115 "scale" : "2x"
116 },
117 {
118 "size" : "72x72",
119 "idiom" : "ipad",
120 "filename" : "Icon-72.png",
121 "scale" : "1x"
122 },
123 {
124 "size" : "72x72",
125 "idiom" : "ipad",
126 "filename" : "Icon-72@2x.png",
127 "scale" : "2x"
128 },
129 {
130 "size" : "76x76",
131 "idiom" : "ipad",
132 "filename" : "Icon-76.png",
133 "scale" : "1x"
134 },
135 {
136 "size" : "76x76",
137 "idiom" : "ipad",
138 "filename" : "Icon-76@2x.png",
139 "scale" : "2x"
140 },
141 {
142 "size" : "83.5x83.5",
143 "idiom" : "ipad",
144 "filename" : "Icon-83.5@2x.png",
145 "scale" : "2x"
146 },
147 {
148 "idiom" : "ios-marketing",
149 "size" : "1024x1024",
150 "scale" : "1x"
151 }
152 ],
153 "info" : {
154 "version" : 1,
155 "author" : "xcode"
156 }
157 }
...\ No newline at end of file ...\ No newline at end of file
1 {
2 "info" : {
3 "version" : 1,
4 "author" : "xcode"
5 }
6 }
...\ No newline at end of file ...\ No newline at end of file
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3 <plist version="1.0">
4 <dict>
5 <key>CFBundleDevelopmentRegion</key>
6 <string>English</string>
7 <key>CFBundleDisplayName</key>
8 <string>${PRODUCT_NAME}</string>
9 <key>CFBundleExecutable</key>
10 <string>${EXECUTABLE_NAME}</string>
11 <key>CFBundleIcons~ipad</key>
12 <dict/>
13 <key>CFBundleIdentifier</key>
14 <string>org.cocos2d.helloworld</string>
15 <key>CFBundleInfoDictionaryVersion</key>
16 <string>6.0</string>
17 <key>CFBundleName</key>
18 <string>${PRODUCT_NAME}</string>
19 <key>CFBundlePackageType</key>
20 <string>APPL</string>
21 <key>CFBundleShortVersionString</key>
22 <string>1.0.0</string>
23 <key>CFBundleSignature</key>
24 <string>????</string>
25 <key>CFBundleVersion</key>
26 <string>1.0</string>
27 <key>LSRequiresIPhoneOS</key>
28 <true/>
29 <key>NSAppTransportSecurity</key>
30 <dict>
31 <key>NSAllowsArbitraryLoads</key>
32 <true/>
33 </dict>
34 <key>UILaunchStoryboardName</key>
35 <string>LaunchScreen</string>
36 <key>UIPrerenderedIcon</key>
37 <true/>
38 <key>UIRequiredDeviceCapabilities</key>
39 <dict>
40 <key>accelerometer</key>
41 <true/>
42 <key>opengles-1</key>
43 <true/>
44 </dict>
45 <key>UIRequiresFullScreen</key>
46 <true/>
47 <key>UIStatusBarHidden</key>
48 <true/>
49 <key>UISupportedInterfaceOrientations</key>
50 <array>
51 <string>UIInterfaceOrientationLandscapeRight</string>
52 <string>UIInterfaceOrientationLandscapeLeft</string>
53 </array>
54 </dict>
55 </plist>
...\ No newline at end of file ...\ No newline at end of file
1 //
2 // Prefix header for all source files of the 'fuse_apk' target in the 'fuse_apk' project
3 //
4
5 #ifdef __OBJC__
6 #import <Foundation/Foundation.h>
7 #import <UIKit/UIKit.h>
8 #endif
1 /****************************************************************************
2 Copyright (c) 2013 cocos2d-x.org
3 Copyright (c) 2013-2016 Chukong Technologies Inc.
4 Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
5
6 http://www.cocos2d-x.org
7
8 Permission is hereby granted, free of charge, to any person obtaining a copy
9 of this software and associated documentation files (the "Software"), to deal
10 in the Software without restriction, including without limitation the rights
11 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 copies of the Software, and to permit persons to whom the Software is
13 furnished to do so, subject to the following conditions:
14
15 The above copyright notice and this permission notice shall be included in
16 all copies or substantial portions of the Software.
17
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 THE SOFTWARE.
25 ****************************************************************************/
26
27 #import <UIKit/UIKit.h>
28
29
30 @interface RootViewController : UIViewController {
31
32 }
33 - (BOOL)prefersStatusBarHidden;
34 @end
1 /****************************************************************************
2 Copyright (c) 2013 cocos2d-x.org
3 Copyright (c) 2013-2016 Chukong Technologies Inc.
4 Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
5
6 http://www.cocos2d-x.org
7
8 Permission is hereby granted, free of charge, to any person obtaining a copy
9 of this software and associated documentation files (the "Software"), to deal
10 in the Software without restriction, including without limitation the rights
11 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 copies of the Software, and to permit persons to whom the Software is
13 furnished to do so, subject to the following conditions:
14
15 The above copyright notice and this permission notice shall be included in
16 all copies or substantial portions of the Software.
17
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 THE SOFTWARE.
25 ****************************************************************************/
26
27 #import "RootViewController.h"
28 #import "cocos2d.h"
29
30 #include "platform/CCApplication.h"
31 #include "platform/ios/CCEAGLView-ios.h"
32
33 @implementation RootViewController
34
35 /*
36 // The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
37 - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
38 if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
39 // Custom initialization
40 }
41 return self;
42 }
43 */
44
45 // Implement loadView to create a view hierarchy programmatically, without using a nib.
46 - (void)loadView {
47 // Set EAGLView as view of RootViewController
48 self.view = (__bridge CCEAGLView *)cocos2d::Application::getInstance()->getView();
49 }
50
51 // Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
52 - (void)viewDidLoad {
53 [super viewDidLoad];
54 }
55
56 - (void)viewWillAppear:(BOOL)animated {
57 [super viewWillAppear:animated];
58 }
59
60 - (void)viewDidDisappear:(BOOL)animated {
61 [super viewDidDisappear:animated];
62 }
63
64
65 // For ios6, use supportedInterfaceOrientations & shouldAutorotate instead
66 #ifdef __IPHONE_6_0
67 - (NSUInteger) supportedInterfaceOrientations{
68 return UIInterfaceOrientationMaskAllButUpsideDown;
69 }
70 #endif
71
72 - (BOOL) shouldAutorotate {
73 return YES;
74 }
75
76 - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
77 [super didRotateFromInterfaceOrientation:fromInterfaceOrientation];
78 }
79
80 //fix not hide status on ios7
81 - (BOOL)prefersStatusBarHidden {
82 return YES;
83 }
84
85 // Controls the application's preferred home indicator auto-hiding when this view controller is shown.
86 - (BOOL)prefersHomeIndicatorAutoHidden {
87 return YES;
88 }
89
90 - (void)didReceiveMemoryWarning {
91 // Releases the view if it doesn't have a superview.
92 [super didReceiveMemoryWarning];
93
94 // Release any cached data, images, etc that aren't in use.
95 }
96
97
98 @end
1 //
2 // SDKWrapper.h
3 // polish_project-mobile
4 //
5 // Created by 杨欣 on 2018/10/20.
6 //
7
8 #import <Foundation/Foundation.h>
9
10 NS_ASSUME_NONNULL_BEGIN
11
12 @interface SDKWrapper : NSObject
13 @property(nonatomic,strong) NSString *name;
14 + (instancetype)getInstance;
15 // iOS应用生命周期
16 - (void)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions;
17 - (void)applicationDidBecomeActive:(UIApplication *)application;
18 - (void)applicationWillResignActive:(UIApplication *)application;
19 - (void)applicationDidEnterBackground:(UIApplication *)application;
20 - (void)applicationWillEnterForeground:(UIApplication *)application;
21 - (void)applicationWillTerminate:(UIApplication *)application;
22 @end
23
24 NS_ASSUME_NONNULL_END
1 //
2 // SDKWrapper.m
3 // polish_project-mobile
4 //
5 // Created by 杨欣 on 2018/10/20.
6 //
7
8 #import "SDKWrapper.h"
9 #import "SDKDelegate.h"
10
11 @interface SDKWrapper ()
12
13 @property (nonatomic, strong) NSArray *sdkClasses;
14
15 @end
16
17 @implementation SDKWrapper
18
19 #pragma mark -
20 #pragma mark Singleton
21
22 static SDKWrapper *mInstace = nil;
23
24 + (instancetype)getInstance {
25 static dispatch_once_t onceToken;
26 dispatch_once(&onceToken, ^{
27 mInstace = [[super allocWithZone:NULL] init];
28 [mInstace initSDKWrapper];
29 });
30 return mInstace;
31 }
32 + (id)allocWithZone:(struct _NSZone *)zone {
33 return [SDKWrapper getInstance];
34 }
35
36 + (id)copyWithZone:(struct _NSZone *)zone {
37 return [SDKWrapper getInstance];
38 }
39
40 #pragma mark -
41 #pragma mark Application lifecycle
42 - (void)initSDKWrapper {
43 [self loadSDKClass];
44 }
45
46 - (void)loadSDKClass {
47 NSString *path = [NSString stringWithFormat:@"%@/project.json",
48 [[NSBundle mainBundle] resourcePath]];
49 NSData *data = [NSData dataWithContentsOfFile:path options:NSDataReadingMappedIfSafe error:nil];
50 id obj = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
51 id dic = obj[@"serviceClassPath"];
52 NSLog(@"%@",dic);
53 NSMutableArray *sdks = [NSMutableArray array];
54 for (NSString *str in dic) {
55 @try {
56 NSString *className = [[str componentsSeparatedByString:@"."] lastObject];
57 NSLog(@"%@",className);
58 Class c = NSClassFromString(className);
59 id sdk = [[c alloc] init];
60 [sdks addObject:sdk];
61 NSLog(@"%@",sdk);
62 } @catch (NSException *e) {
63 NSLog(@"%@",@"NSException");
64 NSLog(@"%@",e);
65 }
66 }
67 self.sdkClasses = [NSArray arrayWithArray:sdks];
68 }
69
70 /**
71 app显示给用户之前执行最后的初始化操作
72 */
73 - (void)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
74 for (id <SDKDelegate> sdk in self.sdkClasses) {
75 if ([sdk respondsToSelector:@selector(application:didFinishLaunchingWithOptions:)]) {
76 [sdk application:application didFinishLaunchingWithOptions:launchOptions];
77 }
78 }
79
80 }
81
82 /**
83 app已经切换到active状态后需要执行的操作
84 */
85 - (void)applicationDidBecomeActive:(UIApplication *)application {
86 for (id sdk in self.sdkClasses) {
87 if ([sdk respondsToSelector:@selector(applicationDidBecomeActive:)]) {
88 [sdk applicationDidBecomeActive:application];
89 }
90 }
91 }
92 /**
93 app将要从前台切换到后台时需要执行的操作
94 */
95 - (void)applicationWillResignActive:(UIApplication *)application {
96 for (id sdk in self.sdkClasses) {
97 if ([sdk respondsToSelector:@selector(applicationWillResignActive:)]) {
98 [sdk applicationWillResignActive:application];
99 }
100 }
101 }
102 /**
103 app已经进入后台后需要执行的操作
104 */
105 - (void)applicationDidEnterBackground:(UIApplication *)application {
106 for (id sdk in self.sdkClasses) {
107 if ([sdk respondsToSelector:@selector(applicationDidEnterBackground:)]) {
108 [sdk applicationDidEnterBackground:application];
109 }
110 }
111 }
112 /**
113 app将要从后台切换到前台需要执行的操作,但app还不是active状态
114 */
115 - (void)applicationWillEnterForeground:(UIApplication *)application {
116 for (id sdk in self.sdkClasses) {
117 if ([sdk respondsToSelector:@selector(applicationWillEnterForeground:)]) {
118 [sdk applicationWillEnterForeground:application];
119 }
120 }
121 }
122 /**
123 app将要结束时需要执行的操作
124 */
125 - (void)applicationWillTerminate:(UIApplication *)application {
126 for (id sdk in self.sdkClasses) {
127 if ([sdk respondsToSelector:@selector(applicationWillTerminate:)]) {
128 [sdk applicationWillTerminate:application];
129 }
130 }
131 }
132
133 @end
1 // Configuration settings file format documentation can be found at:
2 // https://help.apple.com/xcode/#/dev745c5c974
3
4 #include "D:\CocosCreator_2.0.10\resources\cocos2d-x/cocos/platform/ios/CCModuleConfigIOS.debug.xcconfig"
1 // Configuration settings file format documentation can be found at:
2 // https://help.apple.com/xcode/#/dev745c5c974
3
4 #include "D:\CocosCreator_2.0.10\resources\cocos2d-x/cocos/platform/ios/CCModuleConfigIOS.release.xcconfig"
1
2
3 #import <UIKit/UIKit.h>
4
5 int main(int argc, char *argv[]) {
6
7 NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
8 int retVal = UIApplicationMain(argc, argv, nil, @"AppController");
9 [pool release];
10 return retVal;
11 }
1 //
2 // SDKWrapperDelegate.h
3 // polish_project-mobile
4 //
5 // Created by 杨欣 on 2018/10/22.
6 //
7
8 #import <Foundation/Foundation.h>
9
10 NS_ASSUME_NONNULL_BEGIN
11
12 @protocol SDKDelegate <NSObject>
13
14 @optional
15 - (void) optionalFunction;
16 - (void)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions;
17 - (void)applicationDidBecomeActive:(UIApplication *)application;
18 - (void)applicationWillResignActive:(UIApplication *)application;
19 - (void)applicationDidEnterBackground:(UIApplication *)application;
20 - (void)applicationWillEnterForeground:(UIApplication *)application;
21 - (void)applicationWillTerminate:(UIApplication *)application;
22
23 @end
24
25 NS_ASSUME_NONNULL_END
1 /*
2 Localizable.strings
3 */
4
5 "done" = "完成";
6 "next" = "下一个";
7 "search" = "搜索";
8 "go" = "前往";
9 "send" = "发送";
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3 <plist version="1.0">
4 <dict>
5 <key>CFBundleDevelopmentRegion</key>
6 <string>en</string>
7 <key>CFBundleExecutable</key>
8 <string>${EXECUTABLE_NAME}</string>
9 <key>CFBundleIconFile</key>
10 <string>Icon</string>
11 <key>CFBundleIdentifier</key>
12 <string>org.cocos2d.helloworld</string>
13 <key>CFBundleInfoDictionaryVersion</key>
14 <string>6.0</string>
15 <key>CFBundleName</key>
16 <string>${PRODUCT_NAME}</string>
17 <key>CFBundlePackageType</key>
18 <string>APPL</string>
19 <key>CFBundleShortVersionString</key>
20 <string>1.0</string>
21 <key>CFBundleSignature</key>
22 <string>????</string>
23 <key>CFBundleVersion</key>
24 <string>1</string>
25 <key>LSApplicationCategoryType</key>
26 <string>public.app-category.games</string>
27 <key>LSMinimumSystemVersion</key>
28 <string>${MACOSX_DEPLOYMENT_TARGET}</string>
29 <key>NSHumanReadableCopyright</key>
30 <string>Copyright © 2013. All rights reserved.</string>
31 <key>NSMainNibFile</key>
32 <string>MainMenu</string>
33 <key>NSPrincipalClass</key>
34 <string>NSApplication</string>
35 <key>NSAppTransportSecurity</key>
36 <dict>
37 <key>NSAllowsArbitraryLoads</key>
38 <true/>
39 </dict>
40 </dict>
41 </plist>
1 //
2 // Prefix header for all source files of the 'Paralaxer' target in the 'Paralaxer' project
3 //
4
5 #ifdef __OBJC__
6 #import <Cocoa/Cocoa.h>
7 #endif
1 // Configuration settings file format documentation can be found at:
2 // https://help.apple.com/xcode/#/dev745c5c974
3
4 #include "D:\CocosCreator_2.0.10\resources\cocos2d-x/cocos/platform/mac/CCModuleConfigMac.debug.xcconfig"
1 // Configuration settings file format documentation can be found at:
2 // https://help.apple.com/xcode/#/dev745c5c974
3
4 #include "D:\CocosCreator_2.0.10\resources\cocos2d-x/cocos/platform/mac/CCModuleConfigMac.release.xcconfig"
1 /****************************************************************************
2 Copyright (c) 2010 cocos2d-x.org
3 Copyright (c) 2013-2016 Chukong Technologies Inc.
4 Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
5
6 http://www.cocos2d-x.org
7
8 Permission is hereby granted, free of charge, to any person obtaining a copy
9 of this software and associated documentation files (the "Software"), to deal
10 in the Software without restriction, including without limitation the rights
11 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 copies of the Software, and to permit persons to whom the Software is
13 furnished to do so, subject to the following conditions:
14
15 The above copyright notice and this permission notice shall be included in
16 all copies or substantial portions of the Software.
17
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 THE SOFTWARE.
25 ****************************************************************************/
26
27 #include "AppDelegate.h"
28
29 int main(int argc, char *argv[])
30 {
31 AppDelegate app(960, 640);
32 app.start();
33 return 0;
34 }
1 {
2 "copy_resources": [
3 {
4 "from": "../../../src",
5 "to": "src"
6 },
7 {
8 "from": "../../../res",
9 "to": "res"
10 },
11 {
12 "from": "../../../subpackages",
13 "to": "subpackages"
14 },
15 {
16 "from": "../../../main.js",
17 "to": ""
18 },
19 {
20 "from": "../../../project.json",
21 "to": ""
22 },
23 {
24 "from": "../../../jsb-adapter",
25 "to": "jsb-adapter"
26 }
27 ]
28 }
1 <?xml version="1.0" encoding="utf-8"?>
2 <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 <ItemGroup>
4 <Filter Include="resource">
5 <UniqueIdentifier>{ca9c9e15-d942-43a1-aa7a-5f0b74ca1afd}</UniqueIdentifier>
6 <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;jpg;jpeg;jpe;png;manifest</Extensions>
7 </Filter>
8 <Filter Include="win32">
9 <UniqueIdentifier>{ccb2323b-1cfa-41ea-bcf4-ba5f07309396}</UniqueIdentifier>
10 </Filter>
11 <Filter Include="Classes">
12 <UniqueIdentifier>{e93a77e1-af1e-4400-87d3-504b62ebdbb0}</UniqueIdentifier>
13 </Filter>
14 </ItemGroup>
15 <ItemGroup>
16 <ClCompile Include="main.cpp">
17 <Filter>win32</Filter>
18 </ClCompile>
19 <ClCompile Include="..\Classes\AppDelegate.cpp">
20 <Filter>Classes</Filter>
21 </ClCompile>
22 <ClCompile Include="..\Classes\jsb_module_register.cpp">
23 <Filter>Classes</Filter>
24 </ClCompile>
25 </ItemGroup>
26 <ItemGroup>
27 <ClInclude Include="..\Classes\AppDelegate.h">
28 <Filter>Classes</Filter>
29 </ClInclude>
30 <ClInclude Include="main.h">
31 <Filter>win32</Filter>
32 </ClInclude>
33 <ClInclude Include="resource.h" />
34 </ItemGroup>
35 <ItemGroup>
36 <ResourceCompile Include="game.rc">
37 <Filter>resource</Filter>
38 </ResourceCompile>
39 </ItemGroup>
40 <ItemGroup>
41 <Image Include="res\game.ico">
42 <Filter>resource</Filter>
43 </Image>
44 </ItemGroup>
45 </Project>
...\ No newline at end of file ...\ No newline at end of file
1 <?xml version="1.0" encoding="utf-8"?>
2 <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
4 <LocalDebuggerWorkingDirectory>$(OutDir)</LocalDebuggerWorkingDirectory>
5 <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
6 </PropertyGroup>
7 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
8 <LocalDebuggerWorkingDirectory>$(OutDir)</LocalDebuggerWorkingDirectory>
9 <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
10 </PropertyGroup>
11 </Project>
...\ No newline at end of file ...\ No newline at end of file
1 // Microsoft Visual C++ generated resource script.
2 //
3 #include "resource.h"
4
5 #define APSTUDIO_READONLY_SYMBOLS
6 /////////////////////////////////////////////////////////////////////////////
7 //
8 // Generated from the TEXTINCLUDE 2 resource.
9 //
10 #include "winresrc.h"
11
12 /////////////////////////////////////////////////////////////////////////////
13 #undef APSTUDIO_READONLY_SYMBOLS
14
15 /////////////////////////////////////////////////////////////////////////////
16 // Chinese (Simplified, PRC) resources
17
18 #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS)
19 LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED
20 #pragma code_page(936)
21
22 #ifdef APSTUDIO_INVOKED
23 /////////////////////////////////////////////////////////////////////////////
24 //
25 // TEXTINCLUDE
26 //
27
28 2 TEXTINCLUDE
29 BEGIN
30 "#include ""winresrc.h""\r\n"
31 "\0"
32 END
33
34 3 TEXTINCLUDE
35 BEGIN
36 "\r\n"
37 "\0"
38 END
39
40 #endif // APSTUDIO_INVOKED
41
42 #endif // Chinese (Simplified, PRC) resources
43 /////////////////////////////////////////////////////////////////////////////
44
45
46 /////////////////////////////////////////////////////////////////////////////
47 // English (United States) resources
48
49 #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
50 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
51 #pragma code_page(1252)
52
53 #ifdef APSTUDIO_INVOKED
54 /////////////////////////////////////////////////////////////////////////////
55 //
56 // TEXTINCLUDE
57 //
58
59 1 TEXTINCLUDE
60 BEGIN
61 "resource.h\0"
62 END
63
64 #endif // APSTUDIO_INVOKED
65
66
67 /////////////////////////////////////////////////////////////////////////////
68 //
69 // Icon
70 //
71
72 // Icon with lowest ID value placed first to ensure application icon
73 // remains consistent on all systems.
74 GLFW_ICON ICON "res\\game.ico"
75
76 /////////////////////////////////////////////////////////////////////////////
77 //
78 // Version
79 //
80
81 VS_VERSION_INFO VERSIONINFO
82 FILEVERSION 1,0,0,1
83 PRODUCTVERSION 1,0,0,1
84 FILEFLAGSMASK 0x3fL
85 #ifdef _DEBUG
86 FILEFLAGS 0x1L
87 #else
88 FILEFLAGS 0x0L
89 #endif
90 FILEOS 0x4L
91 FILETYPE 0x2L
92 FILESUBTYPE 0x0L
93 BEGIN
94 BLOCK "StringFileInfo"
95 BEGIN
96 BLOCK "040904B0"
97 BEGIN
98 VALUE "FileDescription", "game Module"
99 VALUE "FileVersion", "1, 0, 0, 1"
100 VALUE "InternalName", "game"
101 VALUE "LegalCopyright", "Copyright "
102 VALUE "OriginalFilename", "game.exe"
103 VALUE "ProductName", "game Module"
104 VALUE "ProductVersion", "1, 0, 0, 1"
105 END
106 END
107 BLOCK "VarFileInfo"
108 BEGIN
109 VALUE "Translation", 0x409, 1200
110 END
111 END
112
113 #endif // English (United States) resources
114 /////////////////////////////////////////////////////////////////////////////
115
116
117
118 #ifndef APSTUDIO_INVOKED
119 /////////////////////////////////////////////////////////////////////////////
120 //
121 // Generated from the TEXTINCLUDE 3 resource.
122 //
123
124
125 /////////////////////////////////////////////////////////////////////////////
126 #endif // not APSTUDIO_INVOKED
...\ No newline at end of file ...\ No newline at end of file
1 /****************************************************************************
2 Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
3
4 http://www.cocos.com
5
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated engine source code (the "Software"), a limited,
8 worldwide, royalty-free, non-assignable, revocable and non-exclusive license
9 to use Cocos Creator solely to develop games on your target platforms. You shall
10 not use Cocos Creator software for developing other software or tools that's
11 used for developing games. You are not granted to publish, distribute,
12 sublicense, and/or sell copies of Cocos Creator.
13
14 The software or tools in this License Agreement are licensed, not sold.
15 Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
16
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 THE SOFTWARE.
24 ****************************************************************************/
25
26 #include "main.h"
27 #include "AppDelegate.h"
28
29 USING_NS_CC;
30
31 // uncomment below line, open debug console
32 // #define USE_WIN32_CONSOLE
33
34 int APIENTRY _tWinMain(HINSTANCE hInstance,
35 HINSTANCE hPrevInstance,
36 LPTSTR lpCmdLine,
37 int nCmdShow)
38 {
39 UNREFERENCED_PARAMETER(hPrevInstance);
40 UNREFERENCED_PARAMETER(lpCmdLine);
41
42 #ifdef USE_WIN32_CONSOLE
43 AllocConsole();
44 freopen("CONIN$", "r", stdin);
45 freopen("CONOUT$", "w", stdout);
46 freopen("CONOUT$", "w", stderr);
47 #endif
48
49 // create the application instance
50 AppDelegate app(960, 640);
51 app.start();
52
53 #ifdef USE_WIN32_CONSOLE
54 FreeConsole();
55 #endif
56
57 return 0;
58 }
1 /****************************************************************************
2 Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
3
4 http://www.cocos.com
5
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated engine source code (the "Software"), a limited,
8 worldwide, royalty-free, non-assignable, revocable and non-exclusive license
9 to use Cocos Creator solely to develop games on your target platforms. You shall
10 not use Cocos Creator software for developing other software or tools that's
11 used for developing games. You are not granted to publish, distribute,
12 sublicense, and/or sell copies of Cocos Creator.
13
14 The software or tools in this License Agreement are licensed, not sold.
15 Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
16
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 THE SOFTWARE.
24 ****************************************************************************/
25
26 #ifndef __MAIN_H__
27 #define __MAIN_H__
28
29 #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
30
31 // Windows Header Files:
32 #include <tchar.h>
33
34 // C RunTime Header Files
35 #include "CCStdC.h"
36
37 #endif // __WINMAIN_H__
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
No preview for this file type
No preview for this file type
No preview for this file type