mirror of
https://github.com/smallmain/cocos-enhance-kit.git
synced 2025-11-09 08:05:24 +00:00
Deploy website - based on b241545287
This commit is contained in:
7
demo/jsb-link/frameworks/runtime-src/proj.android-studio/.gitignore
vendored
Normal file
7
demo/jsb-link/frameworks/runtime-src/proj.android-studio/.gitignore
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
.gradle
|
||||
/local.properties
|
||||
/.idea/workspace.xml
|
||||
/.idea/libraries
|
||||
.DS_Store
|
||||
/build
|
||||
/captures
|
||||
2
demo/jsb-link/frameworks/runtime-src/proj.android-studio/app/.gitignore
vendored
Normal file
2
demo/jsb-link/frameworks/runtime-src/proj.android-studio/app/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/build
|
||||
/jniLibs
|
||||
@@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.cocos2d.demo"
|
||||
android:installLocation="auto">
|
||||
|
||||
<uses-feature android:glEsVersion="0x00020000" />
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:label="@string/app_name"
|
||||
android:usesCleartextTraffic="true"
|
||||
android:icon="@mipmap/ic_launcher">
|
||||
<!-- Tell Cocos2dxActivity the name of our .so -->
|
||||
<meta-data android:name="android.app.lib_name"
|
||||
android:value="cocos2djs" />
|
||||
|
||||
<activity
|
||||
android:name="org.cocos2dx.javascript.AppActivity"
|
||||
android:screenOrientation="sensorLandscape"
|
||||
android:configChanges="orientation|keyboardHidden|screenSize|screenLayout|uiMode"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
||||
android:launchMode="singleTask"
|
||||
android:taskAffinity=""
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -0,0 +1,130 @@
|
||||
import org.apache.tools.ant.taskdefs.condition.Os
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion PROP_COMPILE_SDK_VERSION.toInteger()
|
||||
buildToolsVersion PROP_BUILD_TOOLS_VERSION
|
||||
|
||||
defaultConfig {
|
||||
applicationId "org.cocos2d.demo"
|
||||
minSdkVersion PROP_MIN_SDK_VERSION
|
||||
targetSdkVersion PROP_TARGET_SDK_VERSION
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
externalNativeBuild {
|
||||
ndkBuild {
|
||||
if (!project.hasProperty("PROP_NDK_MODE") || PROP_NDK_MODE.compareTo('none') != 0) {
|
||||
// skip the NDK Build step if PROP_NDK_MODE is none
|
||||
targets 'cocos2djs'
|
||||
arguments 'NDK_TOOLCHAIN_VERSION=clang'
|
||||
|
||||
def module_paths = [project.file("/Users/smallmain/Documents/Work/cocos-service-pack-src/cocos2d-x"),
|
||||
project.file("/Users/smallmain/Documents/Work/cocos-service-pack-src/cocos2d-x/cocos"),
|
||||
project.file("/Users/smallmain/Documents/Work/cocos-service-pack-src/cocos2d-x/external")]
|
||||
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
|
||||
arguments 'NDK_MODULE_PATH=' + module_paths.join(";")
|
||||
}
|
||||
else {
|
||||
arguments 'NDK_MODULE_PATH=' + module_paths.join(':')
|
||||
}
|
||||
|
||||
arguments '-j' + Runtime.runtime.availableProcessors()
|
||||
}
|
||||
}
|
||||
ndk {
|
||||
abiFilters PROP_APP_ABI.split(':')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets.main {
|
||||
java.srcDirs "../src", "src"
|
||||
res.srcDirs "../res", 'res'
|
||||
jniLibs.srcDirs "../libs", 'libs'
|
||||
manifest.srcFile "AndroidManifest.xml"
|
||||
}
|
||||
|
||||
externalNativeBuild {
|
||||
ndkBuild {
|
||||
if (!project.hasProperty("PROP_NDK_MODE") || PROP_NDK_MODE.compareTo('none') != 0) {
|
||||
// skip the NDK Build step if PROP_NDK_MODE is none
|
||||
path "jni/Android.mk"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
|
||||
release {
|
||||
if (project.hasProperty("RELEASE_STORE_FILE")) {
|
||||
storeFile file(RELEASE_STORE_FILE)
|
||||
storePassword RELEASE_STORE_PASSWORD
|
||||
keyAlias RELEASE_KEY_ALIAS
|
||||
keyPassword RELEASE_KEY_PASSWORD
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
debuggable false
|
||||
jniDebuggable false
|
||||
renderscriptDebuggable false
|
||||
minifyEnabled true
|
||||
shrinkResources true
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
if (project.hasProperty("RELEASE_STORE_FILE")) {
|
||||
signingConfig signingConfigs.release
|
||||
}
|
||||
|
||||
externalNativeBuild {
|
||||
ndkBuild {
|
||||
arguments 'NDK_DEBUG=0'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
debug {
|
||||
debuggable true
|
||||
jniDebuggable true
|
||||
renderscriptDebuggable true
|
||||
externalNativeBuild {
|
||||
ndkBuild {
|
||||
arguments 'NDK_DEBUG=1'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
android.applicationVariants.all { variant ->
|
||||
// delete previous files first
|
||||
delete "${buildDir}/intermediates/merged_assets/${variant.dirName}"
|
||||
|
||||
variant.mergeAssets.doLast {
|
||||
def sourceDir = "${buildDir}/../../../../.."
|
||||
|
||||
copy {
|
||||
from "${sourceDir}"
|
||||
include "assets/**"
|
||||
include "src/**"
|
||||
include "jsb-adapter/**"
|
||||
into outputDir
|
||||
}
|
||||
|
||||
copy {
|
||||
from "${sourceDir}/main.js"
|
||||
from "${sourceDir}/project.json"
|
||||
into outputDir
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: '../libs', include: ['*.jar','*.aar'])
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar','*.aar'])
|
||||
implementation fileTree(dir: "/Users/smallmain/Documents/Work/cocos-service-pack-src/cocos2d-x/cocos/platform/android/java/libs", include: ['*.jar'])
|
||||
implementation project(':libcocos2dx')
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
include $(LOCAL_PATH)/../../jni/CocosAndroid.mk
|
||||
@@ -0,0 +1,2 @@
|
||||
LOCAL_PATH :=$(call my-dir)
|
||||
include $(LOCAL_PATH)/../../jni/CocosApplication.mk
|
||||
44
demo/jsb-link/frameworks/runtime-src/proj.android-studio/app/proguard-rules.pro
vendored
Normal file
44
demo/jsb-link/frameworks/runtime-src/proj.android-studio/app/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# By default, the flags in this file are appended to flags specified
|
||||
# in E:\developSoftware\Android\SDK/tools/proguard/proguard-android.txt
|
||||
# You can edit the include path and order by changing the proguardFiles
|
||||
# directive in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# Add any project specific keep options here:
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Proguard Cocos2d-x-lite for release
|
||||
-keep public class org.cocos2dx.** { *; }
|
||||
-dontwarn org.cocos2dx.**
|
||||
|
||||
# Proguard Apache HTTP for release
|
||||
-keep class org.apache.http.** { *; }
|
||||
-dontwarn org.apache.http.**
|
||||
|
||||
# Proguard okhttp for release
|
||||
-keep class okhttp3.** { *; }
|
||||
-dontwarn okhttp3.**
|
||||
|
||||
-keep class okio.** { *; }
|
||||
-dontwarn okio.**
|
||||
|
||||
# Proguard Android Webivew for release. you can comment if you are not using a webview
|
||||
-keep public class android.net.http.SslError
|
||||
-keep public class android.webkit.WebViewClient
|
||||
|
||||
-dontwarn android.webkit.WebView
|
||||
-dontwarn android.net.http.SslError
|
||||
-dontwarn android.webkit.WebViewClient
|
||||
|
||||
# keep anysdk for release. you can comment if you are not using anysdk
|
||||
-keep public class com.anysdk.** { *; }
|
||||
-dontwarn com.anysdk.**
|
||||
@@ -0,0 +1,11 @@
|
||||
# This file is automatically generated by Android Tools.
|
||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||
#
|
||||
# This file must be checked in Version Control Systems.
|
||||
#
|
||||
# To customize properties used by the Ant build system use,
|
||||
# "ant.properties", and override values to adapt the script to your
|
||||
# project structure.
|
||||
|
||||
# Project target.
|
||||
target=android-10
|
||||
@@ -0,0 +1,144 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2015-2016 Chukong Technologies Inc.
|
||||
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
package org.cocos2dx.javascript;
|
||||
|
||||
import org.cocos2dx.lib.Cocos2dxActivity;
|
||||
import org.cocos2dx.lib.Cocos2dxGLSurfaceView;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
|
||||
public class AppActivity extends Cocos2dxActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
// Workaround in
|
||||
// https://stackoverflow.com/questions/16283079/re-launch-of-activity-on-home-button-but-only-the-first-time/16447508
|
||||
if (!isTaskRoot()) {
|
||||
// Android launched another instance of the root activity into an existing task
|
||||
// so just quietly finish and go away, dropping the user back into the activity
|
||||
// at the top of the stack (ie: the last state of this task)
|
||||
// Don't need to finish it again since it's finished in super.onCreate .
|
||||
return;
|
||||
}
|
||||
// DO OTHER INITIALIZATION BELOW
|
||||
SDKWrapper.getInstance().init(this);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cocos2dxGLSurfaceView onCreateView() {
|
||||
Cocos2dxGLSurfaceView glSurfaceView = new Cocos2dxGLSurfaceView(this);
|
||||
// TestCpp should create stencil buffer
|
||||
glSurfaceView.setEGLConfigChooser(5, 6, 5, 0, 16, 8);
|
||||
SDKWrapper.getInstance().setGLSurfaceView(glSurfaceView, this);
|
||||
|
||||
return glSurfaceView;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
SDKWrapper.getInstance().onResume();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
SDKWrapper.getInstance().onPause();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
// Workaround in https://stackoverflow.com/questions/16283079/re-launch-of-activity-on-home-button-but-only-the-first-time/16447508
|
||||
if (!isTaskRoot()) {
|
||||
return;
|
||||
}
|
||||
|
||||
SDKWrapper.getInstance().onDestroy();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
SDKWrapper.getInstance().onActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
SDKWrapper.getInstance().onNewIntent(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRestart() {
|
||||
super.onRestart();
|
||||
SDKWrapper.getInstance().onRestart();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
SDKWrapper.getInstance().onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
SDKWrapper.getInstance().onBackPressed();
|
||||
super.onBackPressed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
SDKWrapper.getInstance().onConfigurationChanged(newConfig);
|
||||
super.onConfigurationChanged(newConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRestoreInstanceState(Bundle savedInstanceState) {
|
||||
SDKWrapper.getInstance().onRestoreInstanceState(savedInstanceState);
|
||||
super.onRestoreInstanceState(savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
SDKWrapper.getInstance().onSaveInstanceState(outState);
|
||||
super.onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
SDKWrapper.getInstance().onStart();
|
||||
super.onStart();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"ndk_module_path" :[
|
||||
"/Users/smallmain/Documents/Work/cocos-service-pack-src/cocos2d-x",
|
||||
"/Users/smallmain/Documents/Work/cocos-service-pack-src/cocos2d-x/cocos",
|
||||
"/Users/smallmain/Documents/Work/cocos-service-pack-src/cocos2d-x/external"
|
||||
],
|
||||
"copy_resources": []
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
|
||||
buildscript {
|
||||
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:4.2.2'
|
||||
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
flatDir {
|
||||
dirs 'libs'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task clean(type: Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
# Project-wide Gradle settings.
|
||||
|
||||
# IDE (e.g. Android Studio) users:
|
||||
# Gradle settings configured through the IDE *will override*
|
||||
# any settings specified in this file.
|
||||
|
||||
# For more details on how to configure your build environment visit
|
||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
# Default value: -Xmx10248m -XX:MaxPermSize=256m
|
||||
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
|
||||
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
# org.gradle.parallel=true
|
||||
|
||||
# Android SDK version that will be used as the compile project
|
||||
PROP_COMPILE_SDK_VERSION=27
|
||||
|
||||
# Android SDK version that will be used as the earliest version of android this application can run on
|
||||
PROP_MIN_SDK_VERSION=16
|
||||
|
||||
# Android SDK version that will be used as the latest version of android this application has been tested on
|
||||
PROP_TARGET_SDK_VERSION=27
|
||||
|
||||
# Android Build Tools version that will be used as the compile project
|
||||
PROP_BUILD_TOOLS_VERSION=28.0.3
|
||||
|
||||
# List of CPU Archtexture to build that application with
|
||||
# Available architextures (armeabi-v7a | arm64-v8a | x86)
|
||||
# To build for multiple architexture, use the `:` between them
|
||||
# Example - PROP_APP_ABI=armeabi-v7a:arm64-v8a:x86
|
||||
PROP_APP_ABI=armeabi-v7a
|
||||
|
||||
# fill in sign information for release mode
|
||||
RELEASE_STORE_FILE=
|
||||
RELEASE_STORE_PASSWORD=
|
||||
RELEASE_KEY_ALIAS=
|
||||
RELEASE_KEY_PASSWORD=
|
||||
|
||||
android.injected.testOnly=false
|
||||
|
||||
# android.enableJetifier=true
|
||||
BIN
demo/jsb-link/frameworks/runtime-src/proj.android-studio/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
demo/jsb-link/frameworks/runtime-src/proj.android-studio/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
@@ -0,0 +1,6 @@
|
||||
#Fri Oct 27 10:18:28 CST 2017
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
|
||||
164
demo/jsb-link/frameworks/runtime-src/proj.android-studio/gradlew
vendored
Normal file
164
demo/jsb-link/frameworks/runtime-src/proj.android-studio/gradlew
vendored
Normal file
@@ -0,0 +1,164 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn ( ) {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die ( ) {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
esac
|
||||
|
||||
# For Cygwin, ensure paths are in UNIX format before anything is touched.
|
||||
if $cygwin ; then
|
||||
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
||||
fi
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >&-
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >&-
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||
function splitJvmOpts() {
|
||||
JVM_OPTS=("$@")
|
||||
}
|
||||
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||
|
||||
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
||||
90
demo/jsb-link/frameworks/runtime-src/proj.android-studio/gradlew.bat
vendored
Normal file
90
demo/jsb-link/frameworks/runtime-src/proj.android-studio/gradlew.bat
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windowz variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
goto execute
|
||||
|
||||
:4NT_args
|
||||
@rem Get arguments from the 4NT Shell from JP Software
|
||||
set CMD_LINE_ARGS=%$
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
1
demo/jsb-link/frameworks/runtime-src/proj.android-studio/instantapp/.gitignore
vendored
Normal file
1
demo/jsb-link/frameworks/runtime-src/proj.android-studio/instantapp/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
||||
@@ -0,0 +1,56 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:dist="http://schemas.android.com/apk/distribution"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="org.cocos2dx.javascript">
|
||||
<dist:module dist:instant="true" />
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher"
|
||||
android:usesCleartextTraffic="true"
|
||||
android:supportsRtl="true">
|
||||
<meta-data
|
||||
android:name="aia-compat-api-min-version"
|
||||
android:value="1" />
|
||||
|
||||
<meta-data android:name="android.app.lib_name"
|
||||
android:value="cocos2djs" />
|
||||
|
||||
<activity
|
||||
android:name="org.cocos2dx.javascript.InstantAppActivity"
|
||||
android:screenOrientation="sensorLandscape"
|
||||
android:configChanges="orientation|keyboardHidden|screenSize|screenLayout|uiMode"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTask"
|
||||
android:taskAffinity=""
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
||||
android:exported="true">
|
||||
|
||||
<intent-filter android:order="1">
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
<uses-feature android:glEsVersion="0x00020000" />
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>
|
||||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.RESTART_PACKAGES" />
|
||||
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"
|
||||
tools:ignore="ProtectedPermissions" />
|
||||
<uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" />
|
||||
</manifest>
|
||||
@@ -0,0 +1,129 @@
|
||||
import org.apache.tools.ant.taskdefs.condition.Os
|
||||
apply plugin: 'com.android.application'
|
||||
android {
|
||||
|
||||
compileSdkVersion PROP_COMPILE_SDK_VERSION.toInteger()
|
||||
buildToolsVersion PROP_BUILD_TOOLS_VERSION
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion PROP_MIN_SDK_VERSION
|
||||
targetSdkVersion PROP_TARGET_SDK_VERSION
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
externalNativeBuild {
|
||||
ndkBuild {
|
||||
if (!project.hasProperty("PROP_NDK_MODE") || PROP_NDK_MODE.compareTo('none') != 0) {
|
||||
// skip the NDK Build step if PROP_NDK_MODE is none
|
||||
targets 'cocos2djs'
|
||||
arguments 'NDK_TOOLCHAIN_VERSION=clang'
|
||||
|
||||
def module_paths = [project.file("/Users/smallmain/Documents/Work/cocos-service-pack-src/cocos2d-x"),
|
||||
project.file("/Users/smallmain/Documents/Work/cocos-service-pack-src/cocos2d-x/cocos"),
|
||||
project.file("/Users/smallmain/Documents/Work/cocos-service-pack-src/cocos2d-x/external")]
|
||||
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
|
||||
arguments 'NDK_MODULE_PATH=' + module_paths.join(";")
|
||||
}
|
||||
else {
|
||||
arguments 'NDK_MODULE_PATH=' + module_paths.join(':')
|
||||
}
|
||||
|
||||
arguments '-j' + Runtime.runtime.availableProcessors()
|
||||
}
|
||||
}
|
||||
ndk {
|
||||
abiFilters PROP_APP_ABI.split(':')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets.main {
|
||||
java.srcDirs "../src", "src"
|
||||
res.srcDirs "../res", 'res'
|
||||
jniLibs.srcDirs "../libs", 'libs'
|
||||
manifest.srcFile "AndroidManifest.xml"
|
||||
}
|
||||
|
||||
externalNativeBuild {
|
||||
ndkBuild {
|
||||
if (!project.hasProperty("PROP_NDK_MODE") || PROP_NDK_MODE.compareTo('none') != 0) {
|
||||
// skip the NDK Build step if PROP_NDK_MODE is none
|
||||
path "jni/Android.mk"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
|
||||
release {
|
||||
if (project.hasProperty("RELEASE_STORE_FILE")) {
|
||||
storeFile file(RELEASE_STORE_FILE)
|
||||
storePassword RELEASE_STORE_PASSWORD
|
||||
keyAlias RELEASE_KEY_ALIAS
|
||||
keyPassword RELEASE_KEY_PASSWORD
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
debuggable false
|
||||
jniDebuggable false
|
||||
renderscriptDebuggable false
|
||||
minifyEnabled true
|
||||
shrinkResources true
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
if (project.hasProperty("RELEASE_STORE_FILE")) {
|
||||
signingConfig signingConfigs.release
|
||||
}
|
||||
|
||||
externalNativeBuild {
|
||||
ndkBuild {
|
||||
arguments 'NDK_DEBUG=0'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
debug {
|
||||
debuggable true
|
||||
jniDebuggable true
|
||||
renderscriptDebuggable true
|
||||
externalNativeBuild {
|
||||
ndkBuild {
|
||||
arguments 'NDK_DEBUG=1'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
android.applicationVariants.all { variant ->
|
||||
// delete previous files first
|
||||
delete "${buildDir}/intermediates/merged_assets/"
|
||||
|
||||
variant.mergeAssets.doLast {
|
||||
def sourceDir = "${buildDir}/../../../../.."
|
||||
|
||||
copy {
|
||||
from "${sourceDir}"
|
||||
include "assets/**"
|
||||
include "src/**"
|
||||
include "jsb-adapter/**"
|
||||
into outputDir
|
||||
}
|
||||
|
||||
copy {
|
||||
from "${sourceDir}/main.js"
|
||||
from "${sourceDir}/project.json"
|
||||
into outputDir
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: '../libs', include: ['*.jar','*.aar'])
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar','*.aar'])
|
||||
implementation fileTree(dir: "/Users/smallmain/Documents/Work/cocos-service-pack-src/cocos2d-x/cocos/platform/android/java/libs", include: ['*.jar'])
|
||||
implementation project(':libcocos2dx')
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
LOCAL_PATH :=$(call my-dir)
|
||||
include $(LOCAL_PATH)/../../jni/CocosAndroid.mk
|
||||
@@ -0,0 +1,5 @@
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
include $(LOCAL_PATH)/../../jni/CocosApplication.mk
|
||||
|
||||
# Android instant apps flag
|
||||
APP_CFLAGS += -DANDROID_INSTANT=1
|
||||
45
demo/jsb-link/frameworks/runtime-src/proj.android-studio/instantapp/proguard-rules.pro
vendored
Normal file
45
demo/jsb-link/frameworks/runtime-src/proj.android-studio/instantapp/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# By default, the flags in this file are appended to flags specified
|
||||
# in E:\developSoftware\Android\SDK/tools/proguard/proguard-android.txt
|
||||
# You can edit the include path and order by changing the proguardFiles
|
||||
# directive in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# Add any project specific keep options here:
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Proguard Cocos2d-x-lite for release
|
||||
-keep public class org.cocos2dx.** { *; }
|
||||
-dontwarn org.cocos2dx.**
|
||||
|
||||
# Proguard Apache HTTP for release
|
||||
-keep class org.apache.http.** { *; }
|
||||
-dontwarn org.apache.http.**
|
||||
|
||||
# Proguard okhttp for release
|
||||
-keep class okhttp3.** { *; }
|
||||
-dontwarn okhttp3.**
|
||||
|
||||
-keep class okio.** { *; }
|
||||
-dontwarn okio.**
|
||||
|
||||
|
||||
# Proguard Android Webivew for release. you can comment if you are not using a webview
|
||||
-keep public class android.net.http.SslError
|
||||
-keep public class android.webkit.WebViewClient
|
||||
|
||||
-dontwarn android.webkit.WebView
|
||||
-dontwarn android.net.http.SslError
|
||||
-dontwarn android.webkit.WebViewClient
|
||||
|
||||
# keep anysdk for release. you can comment if you are not using anysdk
|
||||
-keep public class com.anysdk.** { *; }
|
||||
-dontwarn com.anysdk.**
|
||||
@@ -0,0 +1,144 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2015-2016 Chukong Technologies Inc.
|
||||
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
package org.cocos2dx.javascript;
|
||||
|
||||
import org.cocos2dx.lib.Cocos2dxActivity;
|
||||
import org.cocos2dx.lib.Cocos2dxGLSurfaceView;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
|
||||
public class InstantAppActivity extends Cocos2dxActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
// Workaround in
|
||||
// https://stackoverflow.com/questions/16283079/re-launch-of-activity-on-home-button-but-only-the-first-time/16447508
|
||||
if (!isTaskRoot()) {
|
||||
// Android launched another instance of the root activity into an existing task
|
||||
// so just quietly finish and go away, dropping the user back into the activity
|
||||
// at the top of the stack (ie: the last state of this task)
|
||||
// Don't need to finish it again since it's finished in super.onCreate .
|
||||
return;
|
||||
}
|
||||
// DO OTHER INITIALIZATION BELOW
|
||||
SDKWrapper.getInstance().init(this);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cocos2dxGLSurfaceView onCreateView() {
|
||||
Cocos2dxGLSurfaceView glSurfaceView = new Cocos2dxGLSurfaceView(this);
|
||||
// TestCpp should create stencil buffer
|
||||
glSurfaceView.setEGLConfigChooser(5, 6, 5, 0, 16, 8);
|
||||
SDKWrapper.getInstance().setGLSurfaceView(glSurfaceView, this);
|
||||
|
||||
return glSurfaceView;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
SDKWrapper.getInstance().onResume();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
SDKWrapper.getInstance().onPause();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
// Workaround in https://stackoverflow.com/questions/16283079/re-launch-of-activity-on-home-button-but-only-the-first-time/16447508
|
||||
if (!isTaskRoot()) {
|
||||
return;
|
||||
}
|
||||
|
||||
SDKWrapper.getInstance().onDestroy();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
SDKWrapper.getInstance().onActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
SDKWrapper.getInstance().onNewIntent(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRestart() {
|
||||
super.onRestart();
|
||||
SDKWrapper.getInstance().onRestart();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
SDKWrapper.getInstance().onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
SDKWrapper.getInstance().onBackPressed();
|
||||
super.onBackPressed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
SDKWrapper.getInstance().onConfigurationChanged(newConfig);
|
||||
super.onConfigurationChanged(newConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRestoreInstanceState(Bundle savedInstanceState) {
|
||||
SDKWrapper.getInstance().onRestoreInstanceState(savedInstanceState);
|
||||
super.onRestoreInstanceState(savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
SDKWrapper.getInstance().onSaveInstanceState(outState);
|
||||
super.onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
SDKWrapper.getInstance().onStart();
|
||||
super.onStart();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := cocos2djs
|
||||
|
||||
LOCAL_MODULE_FILENAME := libcocos2djs
|
||||
|
||||
ifeq ($(USE_ARM_MODE),1)
|
||||
LOCAL_ARM_MODE := arm
|
||||
endif
|
||||
|
||||
LOCAL_SRC_FILES := hellojavascript/main.cpp \
|
||||
../../Classes/AppDelegate.cpp \
|
||||
../../Classes/jsb_module_register.cpp \
|
||||
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes
|
||||
|
||||
LOCAL_STATIC_LIBRARIES := cocos2dx_static
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
$(call import-module, cocos)
|
||||
@@ -0,0 +1,49 @@
|
||||
APP_STL := c++_static
|
||||
|
||||
# Uncomment this line to compile to armeabi-v7a, your application will run faster but support less devices
|
||||
APP_ABI := armeabi-v7a
|
||||
|
||||
APP_CPPFLAGS := -frtti -std=c++11 -fsigned-char
|
||||
APP_LDFLAGS := -latomic
|
||||
|
||||
# To solve windows commands char length too long
|
||||
APP_SHORT_COMMANDS := true
|
||||
|
||||
USE_ARM_MODE := 1
|
||||
|
||||
# MUST be careful to modify this manually
|
||||
# disable module will speed up compile time, and reduce package size
|
||||
USE_GFX_RENDERER := 1
|
||||
USE_VIDEO := 1
|
||||
USE_WEB_VIEW := 1
|
||||
USE_AUDIO := 1
|
||||
USE_SOCKET := 1
|
||||
USE_SPINE := 1
|
||||
USE_DRAGONBONES := 1
|
||||
USE_TIFF := 1
|
||||
USE_MIDDLEWARE := 1
|
||||
USE_PARTICLE := 1
|
||||
|
||||
APP_CPPFLAGS += -DUSE_GFX_RENDERER=$(USE_GFX_RENDERER)
|
||||
APP_CPPFLAGS += -DUSE_VIDEO=${USE_VIDEO}
|
||||
APP_CPPFLAGS += -DUSE_WEB_VIEW=${USE_WEB_VIEW}
|
||||
APP_CPPFLAGS += -DUSE_AUDIO=${USE_AUDIO}
|
||||
APP_CPPFLAGS += -DUSE_SOCKET=${USE_SOCKET}
|
||||
APP_CPPFLAGS += -DUSE_SPINE=${USE_SPINE}
|
||||
APP_CPPFLAGS += -DUSE_DRAGONBONES=${USE_DRAGONBONES}
|
||||
APP_CPPFLAGS += -DCC_USE_TIFF=${USE_TIFF}
|
||||
APP_CPPFLAGS += -DUSE_MIDDLEWARE=${USE_MIDDLEWARE}
|
||||
APP_CPPFLAGS += -DUSE_PARTICLE=${USE_PARTICLE}
|
||||
|
||||
ifeq ($(NDK_DEBUG),1)
|
||||
APP_CPPFLAGS += -DCOCOS2D_DEBUG=1
|
||||
APP_CFLAGS += -DCOCOS2D_DEBUG=1
|
||||
APP_OPTIM := debug
|
||||
else
|
||||
APP_CPPFLAGS += -DNDEBUG
|
||||
APP_CFLAGS += -DNDEBUG
|
||||
APP_OPTIM := release
|
||||
endif
|
||||
|
||||
# Some Android Simulators don't support SSE instruction, so disable it for x86 arch.
|
||||
APP_CPPFLAGS += -U__SSE__
|
||||
@@ -0,0 +1,53 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#include "AppDelegate.h"
|
||||
#include "cocos2d.h"
|
||||
#include "platform/android/jni/JniHelper.h"
|
||||
#include <jni.h>
|
||||
#include <android/log.h>
|
||||
|
||||
#define LOG_TAG "main"
|
||||
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)
|
||||
using namespace cocos2d;
|
||||
|
||||
//called when JNI_OnLoad()
|
||||
void cocos_jni_env_init(JNIEnv *env)
|
||||
{
|
||||
LOGD("cocos_jni_env_init");
|
||||
}
|
||||
|
||||
//called when onSurfaceCreated()
|
||||
Application *cocos_android_app_init(JNIEnv *env, int width, int height)
|
||||
{
|
||||
LOGD("cocos_android_app_init");
|
||||
auto app = new AppDelegate(width, height);
|
||||
return app;
|
||||
}
|
||||
|
||||
extern "C"
|
||||
{
|
||||
/*JNI_CALL_FUNCTION*/
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 7.0 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 26 KiB |
@@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<string name="app_name" translatable="false">Cocos-Service-Pack-Demo</string>
|
||||
</resources>
|
||||
@@ -0,0 +1,4 @@
|
||||
include ':libcocos2dx',':instantapp'
|
||||
project(':libcocos2dx').projectDir = new File('/Users/smallmain/Documents/Work/cocos-service-pack-src/cocos2d-x/cocos/platform/android/libcocos2dx')
|
||||
include ':Cocos-Service-Pack-Demo'
|
||||
project(':Cocos-Service-Pack-Demo').projectDir = new File(settingsDir, 'app')
|
||||
@@ -0,0 +1,179 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
package org.cocos2dx.javascript;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.AssetManager;
|
||||
import android.content.res.Configuration;
|
||||
import android.opengl.GLSurfaceView;
|
||||
import android.os.Bundle;
|
||||
import org.cocos2dx.javascript.service.SDKClass;
|
||||
import org.json.*;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SDKWrapper {
|
||||
private Context mainActive = null;
|
||||
private static SDKWrapper mInstace = null;
|
||||
private List<SDKClass> sdkClasses;
|
||||
|
||||
public static SDKWrapper getInstance() {
|
||||
if (null == mInstace) {
|
||||
mInstace = new SDKWrapper();
|
||||
}
|
||||
return mInstace;
|
||||
}
|
||||
|
||||
public void init(Context context) {
|
||||
this.mainActive = context;
|
||||
for (SDKClass sdk : this.sdkClasses) {
|
||||
sdk.init(context);
|
||||
}
|
||||
}
|
||||
|
||||
public Context getContext() {
|
||||
return this.mainActive;
|
||||
}
|
||||
|
||||
public void loadSDKClass() {
|
||||
ArrayList<SDKClass> classes = new ArrayList<SDKClass>();
|
||||
try {
|
||||
String json = this.getJson(this.mainActive, "project.json");
|
||||
JSONObject jsonObject = new JSONObject(json);
|
||||
JSONArray serviceClassPath = jsonObject.getJSONArray("serviceClassPath");
|
||||
if (serviceClassPath == null) return;
|
||||
int length = serviceClassPath.length();
|
||||
for (int i = 0; i < length; i++) {
|
||||
String classPath = serviceClassPath.getString(i);
|
||||
SDKClass sdk = (SDKClass) Class.forName(classPath).newInstance();
|
||||
classes.add(sdk);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
this.sdkClasses = classes;
|
||||
}
|
||||
|
||||
private String getJson(Context mContext, String fileName) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
AssetManager am = mContext.getAssets();
|
||||
try {
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(am.open(fileName)));
|
||||
String next = "";
|
||||
while (null != (next = br.readLine())) {
|
||||
sb.append(next);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
sb.delete(0, sb.length());
|
||||
}
|
||||
return sb.toString().trim();
|
||||
}
|
||||
|
||||
public void setGLSurfaceView(GLSurfaceView view, Context context) {
|
||||
this.mainActive = context;
|
||||
this.loadSDKClass();
|
||||
for (SDKClass sdk : this.sdkClasses) {
|
||||
sdk.setGLSurfaceView(view);
|
||||
}
|
||||
}
|
||||
|
||||
public void onResume() {
|
||||
for (SDKClass sdk : this.sdkClasses) {
|
||||
sdk.onResume();
|
||||
}
|
||||
}
|
||||
|
||||
public void onPause() {
|
||||
for (SDKClass sdk : this.sdkClasses) {
|
||||
sdk.onPause();
|
||||
}
|
||||
}
|
||||
|
||||
public void onDestroy() {
|
||||
for (SDKClass sdk : this.sdkClasses) {
|
||||
sdk.onDestroy();
|
||||
}
|
||||
}
|
||||
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
for (SDKClass sdk : this.sdkClasses) {
|
||||
sdk.onActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
}
|
||||
|
||||
public void onNewIntent(Intent intent) {
|
||||
for (SDKClass sdk : this.sdkClasses) {
|
||||
sdk.onNewIntent(intent);
|
||||
}
|
||||
}
|
||||
|
||||
public void onRestart() {
|
||||
for (SDKClass sdk : this.sdkClasses) {
|
||||
sdk.onRestart();
|
||||
}
|
||||
}
|
||||
|
||||
public void onStop() {
|
||||
for (SDKClass sdk : this.sdkClasses) {
|
||||
sdk.onStop();
|
||||
}
|
||||
}
|
||||
|
||||
public void onBackPressed() {
|
||||
for (SDKClass sdk : this.sdkClasses) {
|
||||
sdk.onBackPressed();
|
||||
}
|
||||
}
|
||||
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
for (SDKClass sdk : this.sdkClasses) {
|
||||
sdk.onConfigurationChanged(newConfig);
|
||||
}
|
||||
}
|
||||
|
||||
public void onRestoreInstanceState(Bundle savedInstanceState) {
|
||||
for (SDKClass sdk : this.sdkClasses) {
|
||||
sdk.onRestoreInstanceState(savedInstanceState);
|
||||
}
|
||||
}
|
||||
|
||||
public void onSaveInstanceState(Bundle outState) {
|
||||
for (SDKClass sdk : this.sdkClasses) {
|
||||
sdk.onSaveInstanceState(outState);
|
||||
}
|
||||
}
|
||||
|
||||
public void onStart() {
|
||||
for (SDKClass sdk : this.sdkClasses) {
|
||||
sdk.onStart();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package org.cocos2dx.javascript.service;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.opengl.GLSurfaceView;
|
||||
import android.os.Bundle;
|
||||
|
||||
public abstract class SDKClass implements SDKInterface {
|
||||
private Context mainActive = null;
|
||||
public Context getContext(){ return mainActive;}
|
||||
@Override
|
||||
public void init(Context context){ this.mainActive = context; }
|
||||
@Override
|
||||
public void setGLSurfaceView(GLSurfaceView view){}
|
||||
@Override
|
||||
public void onResume(){}
|
||||
@Override
|
||||
public void onPause(){}
|
||||
@Override
|
||||
public void onDestroy(){}
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data){}
|
||||
@Override
|
||||
public void onNewIntent(Intent intent){}
|
||||
@Override
|
||||
public void onRestart(){}
|
||||
@Override
|
||||
public void onStop(){}
|
||||
@Override
|
||||
public void onBackPressed(){}
|
||||
@Override
|
||||
public void onConfigurationChanged(Configuration newConfig){}
|
||||
@Override
|
||||
public void onRestoreInstanceState(Bundle savedInstanceState){}
|
||||
@Override
|
||||
public void onSaveInstanceState(Bundle outState){}
|
||||
@Override
|
||||
public void onStart(){}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.cocos2dx.javascript.service;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.opengl.GLSurfaceView;
|
||||
import android.os.Bundle;
|
||||
|
||||
public interface SDKInterface {
|
||||
void init(Context context);
|
||||
void setGLSurfaceView(GLSurfaceView view);
|
||||
void onResume();
|
||||
void onPause();
|
||||
void onDestroy();
|
||||
void onActivityResult(int requestCode, int resultCode, Intent data);
|
||||
void onNewIntent(Intent intent);
|
||||
void onRestart();
|
||||
void onStop();
|
||||
void onBackPressed();
|
||||
void onConfigurationChanged(Configuration newConfig);
|
||||
void onRestoreInstanceState(Bundle savedInstanceState);
|
||||
void onSaveInstanceState(Bundle outState);
|
||||
void onStart();
|
||||
}
|
||||
Reference in New Issue
Block a user