프로젝트 추가
This commit is contained in:
2
proj.android/app/.gitignore
vendored
Normal file
2
proj.android/app/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/build
|
||||
/.externalNativeBuild
|
||||
35
proj.android/app/AndroidManifest.xml
Normal file
35
proj.android/app/AndroidManifest.xml
Normal file
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:installLocation="auto">
|
||||
|
||||
<uses-feature android:glEsVersion="0x00020000" />
|
||||
|
||||
<application
|
||||
android:label="@string/app_name"
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher">
|
||||
|
||||
<!-- Tell AxmolActivity the name of our .so -->
|
||||
<meta-data android:name="android.app.lib_name"
|
||||
android:value="Pinball" />
|
||||
|
||||
<activity
|
||||
android:name="dev.axmol.app.AppActivity"
|
||||
android:screenOrientation="sensorLandscape"
|
||||
android:configChanges="orientation|keyboardHidden|screenSize"
|
||||
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>
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
|
||||
</manifest>
|
||||
132
proj.android/app/build.gradle
Normal file
132
proj.android/app/build.gradle
Normal file
@@ -0,0 +1,132 @@
|
||||
apply plugin: 'com.android.application'
|
||||
apply from: project(':libaxmol').projectDir.toString() + "/../dsl/axmol.gradle"
|
||||
|
||||
// Resolve build profiles
|
||||
def buildProfiles = AxmolUtils.resolveBuildProfiles(project)
|
||||
|
||||
android {
|
||||
def packageName = buildProfiles['packageName']
|
||||
def cmakeVer = buildProfiles['cmakeVer']
|
||||
def cmakeOptions = Eval.me(buildProfiles['cmakeOptions'])
|
||||
def minSdk = buildProfiles['minSdk']
|
||||
def targetSdk = buildProfiles['targetSdk']
|
||||
|
||||
// Apply build profiles
|
||||
namespace = packageName
|
||||
compileSdk = targetSdk.toInteger()
|
||||
ndkVersion = buildProfiles['ndkVer']
|
||||
if(buildProfiles.containsKey('ndkPath')) {
|
||||
ndkPath = buildProfiles['ndkPath']
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
applicationId packageName
|
||||
minSdkVersion minSdk
|
||||
targetSdkVersion targetSdk
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
arguments = []
|
||||
arguments.addAll(cmakeOptions)
|
||||
cppFlags "-frtti -fexceptions -fsigned-char"
|
||||
}
|
||||
}
|
||||
|
||||
ndk {
|
||||
// noinspection ChromeOsAbiSupport
|
||||
abiFilters = __1K_ARCHS.split(':').collect{it as String}
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets.main {
|
||||
java.srcDir "src"
|
||||
res.srcDir "res"
|
||||
manifest.srcFile "AndroidManifest.xml"
|
||||
assets.srcDir "build/assets"
|
||||
}
|
||||
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
version = cmakeVer
|
||||
path "../../CMakeLists.txt"
|
||||
}
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
release {
|
||||
if (project.hasProperty("KEY_STORE_FILE")) {
|
||||
storeFile file(KEY_STORE_FILE)
|
||||
storePassword KEY_STORE_PASSWORD
|
||||
keyAlias KEY_ALIAS
|
||||
keyPassword KEY_PASSWORD
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
debuggable false
|
||||
jniDebuggable false
|
||||
minifyEnabled true
|
||||
shrinkResources = true
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
proguardFile file(project(':libaxmol').projectDir.toString() + '/proguard-rules.pro')
|
||||
if (project.hasProperty("KEY_STORE_FILE")) {
|
||||
signingConfig signingConfigs.release
|
||||
}
|
||||
}
|
||||
|
||||
debug {
|
||||
debuggable true
|
||||
jniDebuggable true
|
||||
}
|
||||
}
|
||||
|
||||
aaptOptions {
|
||||
noCompress 'mp3','ogg','wav','mp4','ttf','ttc','otf'
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
aidl = true
|
||||
}
|
||||
}
|
||||
|
||||
android.applicationVariants.configureEach { variant ->
|
||||
def variantName = variant.name.capitalize()
|
||||
tasks.register("copy${variantName}ContentToAssets") {
|
||||
doFirst {
|
||||
delete "${projectDir}/build/assets"
|
||||
}
|
||||
doLast {
|
||||
copy {
|
||||
from "${projectDir}/../../Content"
|
||||
into "${projectDir}/build/assets"
|
||||
exclude "**/*.gz"
|
||||
}
|
||||
copy {
|
||||
from "${projectDir}/build/runtime/axslc"
|
||||
into "${projectDir}/build/assets/axslc"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation project(':libaxmol')
|
||||
}
|
||||
|
||||
project.afterEvaluate {
|
||||
android.applicationVariants.configureEach { variant ->
|
||||
def variantName = variant.name.capitalize()
|
||||
def externalNativeBuild = tasks.named("externalNativeBuild${variantName}")
|
||||
if (externalNativeBuild) {
|
||||
def copyContentToAssets = tasks.named("copy${variantName}ContentToAssets")
|
||||
copyContentToAssets
|
||||
copyContentToAssets.get().dependsOn externalNativeBuild
|
||||
tasks.named("compile${variantName}JavaWithJavac").get().dependsOn copyContentToAssets
|
||||
}
|
||||
}
|
||||
}
|
||||
45
proj.android/app/jni/main.cpp
Normal file
45
proj.android/app/jni/main.cpp
Normal file
@@ -0,0 +1,45 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
||||
Copyright (c) 2019-present Axmol Engine contributors (see AUTHORS.md).
|
||||
|
||||
https://axmol.dev/
|
||||
|
||||
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.
|
||||
****************************************************************************/
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <jni.h>
|
||||
|
||||
#include "AppDelegate.h"
|
||||
|
||||
#define LOG_TAG "main"
|
||||
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)
|
||||
|
||||
namespace
|
||||
{
|
||||
std::unique_ptr<AppDelegate> appDelegate;
|
||||
}
|
||||
|
||||
void axmol_android_app_init(JNIEnv* env)
|
||||
{
|
||||
LOGD("axmol_android_app_init");
|
||||
appDelegate.reset(new AppDelegate());
|
||||
}
|
||||
25
proj.android/app/proguard-rules.pro
vendored
Normal file
25
proj.android/app/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# By default, the flags in this file are appended to flags specified
|
||||
# in ${ANDROID_SDK_ROOT}/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 Android Webivew for release. uncomment if you are using a webview in axmol
|
||||
#-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
|
||||
BIN
proj.android/app/res/mipmap-hdpi/ic_launcher.png
LFS
Normal file
BIN
proj.android/app/res/mipmap-hdpi/ic_launcher.png
LFS
Normal file
Binary file not shown.
BIN
proj.android/app/res/mipmap-mdpi/ic_launcher.png
LFS
Normal file
BIN
proj.android/app/res/mipmap-mdpi/ic_launcher.png
LFS
Normal file
Binary file not shown.
BIN
proj.android/app/res/mipmap-xhdpi/ic_launcher.png
LFS
Normal file
BIN
proj.android/app/res/mipmap-xhdpi/ic_launcher.png
LFS
Normal file
Binary file not shown.
BIN
proj.android/app/res/mipmap-xxhdpi/ic_launcher.png
LFS
Normal file
BIN
proj.android/app/res/mipmap-xxhdpi/ic_launcher.png
LFS
Normal file
Binary file not shown.
3
proj.android/app/res/values/strings.xml
Normal file
3
proj.android/app/res/values/strings.xml
Normal file
@@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<string name="app_name">Pinball</string>
|
||||
</resources>
|
||||
64
proj.android/app/src/dev/axmol/app/AppActivity.java
Normal file
64
proj.android/app/src/dev/axmol/app/AppActivity.java
Normal file
@@ -0,0 +1,64 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2015-2016 Chukong Technologies Inc.
|
||||
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
||||
Copyright (c) 2019-present Axmol Engine contributors (see AUTHORS.md).
|
||||
|
||||
https://axmol.dev/
|
||||
|
||||
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 dev.axmol.app;
|
||||
|
||||
import android.os.Bundle;
|
||||
import dev.axmol.lib.AxmolActivity;
|
||||
import dev.axmol.lib.SharedLoader;
|
||||
import android.os.Build;
|
||||
import android.view.WindowManager;
|
||||
import android.view.WindowManager.LayoutParams;
|
||||
|
||||
public class AppActivity extends AxmolActivity {
|
||||
static {
|
||||
// DNT remove, some android simulator require explicit load shared libraries, otherwise will crash
|
||||
SharedLoader.load();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.setEnableVirtualButton(false);
|
||||
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;
|
||||
}
|
||||
// Make sure we're running on Pie or higher to change cutout mode
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
// Enable rendering into the cutout area
|
||||
WindowManager.LayoutParams lp = getWindow().getAttributes();
|
||||
lp.layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
|
||||
getWindow().setAttributes(lp);
|
||||
}
|
||||
// DO OTHER INITIALIZATION BELOW
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user