diff options
| author | ilotterytea <iltsu@alright.party> | 2022-10-06 01:30:35 +0600 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2022-10-06 01:30:35 +0600 |
| commit | 54594c18eebb0f6a2d758cb920f71ff007eef436 (patch) | |
| tree | 5c367ed668274dce37716bb1d6d283aa4dbf7887 | |
| parent | 3c1b7a4b4a85a18deea201f4cd5921fc0fdc649a (diff) | |
наконец-то ебучая поддержка андроидов наступила
| -rw-r--r-- | android/AndroidManifest.xml | 29 | ||||
| -rw-r--r-- | android/build.gradle | 90 | ||||
| -rw-r--r-- | android/proguard-rules.pro | 42 | ||||
| -rw-r--r-- | android/project.properties | 9 | ||||
| -rw-r--r-- | android/res/drawable-hdpi/maxon.png | bin | 0 -> 10340 bytes | |||
| -rw-r--r-- | android/res/drawable-mdpi/maxon.png | bin | 0 -> 5249 bytes | |||
| -rw-r--r-- | android/res/drawable-xhdpi/maxon.png | bin | 0 -> 17088 bytes | |||
| -rw-r--r-- | android/res/drawable-xxhdpi/maxon.png | bin | 0 -> 35049 bytes | |||
| -rw-r--r-- | android/res/drawable-xxxhdpi/maxon.png | bin | 0 -> 58327 bytes | |||
| -rw-r--r-- | android/res/values/strings.xml | 6 | ||||
| -rw-r--r-- | android/src/com/ilotterytea/maxoning/AndroidLauncher.java | 16 | ||||
| -rw-r--r-- | build.gradle | 31 |
12 files changed, 218 insertions, 5 deletions
diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml new file mode 100644 index 0000000..e4a6825 --- /dev/null +++ b/android/AndroidManifest.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + package="com.mygdx.game"> + + <uses-feature android:glEsVersion="0x00020000" android:required="true" /> + + <application + android:allowBackup="true" + android:fullBackupContent="true" + android:icon="@drawable/maxon" + android:isGame="true" + android:appCategory="game" + android:label="@string/app_name" + tools:ignore="UnusedAttribute"> + <activity + android:name="com.ilotterytea.maxoning.AndroidLauncher" + android:label="@string/app_name" + android:screenOrientation="portrait" + android:configChanges="keyboard|keyboardHidden|navigation|orientation|screenSize|screenLayout" + android:exported="true"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + </application> + +</manifest> diff --git a/android/build.gradle b/android/build.gradle new file mode 100644 index 0000000..6671f07 --- /dev/null +++ b/android/build.gradle @@ -0,0 +1,90 @@ +android { + buildToolsVersion "33.0.0" + compileSdkVersion 33 + sourceSets { + main { + manifest.srcFile 'AndroidManifest.xml' + java.srcDirs = ['src'] + aidl.srcDirs = ['src'] + renderscript.srcDirs = ['src'] + res.srcDirs = ['res'] + assets.srcDirs = ['../assets'] + jniLibs.srcDirs = ['libs'] + } + + } + packagingOptions { + exclude 'META-INF/robovm/ios/robovm.xml' + } + defaultConfig { + applicationId "com.ilotterytea.maxoning" + minSdkVersion 16 + targetSdkVersion 33 + versionCode 1 + versionName "Alpha 1.2" + } + buildTypes { + release { + minifyEnabled true + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + + +// called every time gradle gets executed, takes the native dependencies of +// the natives configuration, and extracts them to the proper libs/ folders +// so they get packed with the APK. +task copyAndroidNatives { + doFirst { + file("libs/armeabi-v7a/").mkdirs() + file("libs/arm64-v8a/").mkdirs() + file("libs/x86_64/").mkdirs() + file("libs/x86/").mkdirs() + + configurations.natives.copy().files.each { jar -> + def outputDir = null + if (jar.name.endsWith("natives-arm64-v8a.jar")) outputDir = file("libs/arm64-v8a") + if (jar.name.endsWith("natives-armeabi-v7a.jar")) outputDir = file("libs/armeabi-v7a") + if(jar.name.endsWith("natives-x86_64.jar")) outputDir = file("libs/x86_64") + if(jar.name.endsWith("natives-x86.jar")) outputDir = file("libs/x86") + if(outputDir != null) { + copy { + from zipTree(jar) + into outputDir + include "*.so" + } + } + } + } +} + +tasks.whenTaskAdded { packageTask -> + if (packageTask.name.contains("merge") && packageTask.name.contains("JniLibFolders")) { + packageTask.dependsOn 'copyAndroidNatives' + } +} + +task run(type: Exec) { + def path + def localProperties = project.file("../local.properties") + if (localProperties.exists()) { + Properties properties = new Properties() + localProperties.withInputStream { instr -> + properties.load(instr) + } + def sdkDir = properties.getProperty('sdk.dir') + if (sdkDir) { + path = sdkDir + } else { + path = "$System.env.ANDROID_HOME" + } + } else { + path = "$System.env.ANDROID_HOME" + } + + def adb = path + "/platform-tools/adb" + commandLine "$adb", 'shell', 'am', 'start', '-n', 'com.ilotterytea.maxoning/com.ilotterytea.maxoning.AndroidLauncher' +} + +eclipse.project.name = appName + "-android" diff --git a/android/proguard-rules.pro b/android/proguard-rules.pro new file mode 100644 index 0000000..6e0b079 --- /dev/null +++ b/android/proguard-rules.pro @@ -0,0 +1,42 @@ +# To enable ProGuard in your project, edit project.properties +# to define the proguard.config property as described in that file. +# +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in ${sdk.dir}/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the ProGuard +# include property in project.properties. +# +# 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 *; +#} + +-verbose + +-dontwarn com.badlogic.gdx.backends.android.AndroidFragmentApplication +-dontwarn com.badlogic.gdx.utils.GdxBuild +-dontwarn com.badlogic.gdx.physics.box2d.utils.Box2DBuild +-dontwarn com.badlogic.gdx.jnigen.BuildTarget* +-dontwarn com.badlogic.gdx.graphics.g2d.freetype.FreetypeBuild + +# Required if using Gdx-Controllers extension +-keep class com.badlogic.gdx.controllers.android.AndroidControllers + +# Required if using Box2D extension +-keepclassmembers class com.badlogic.gdx.physics.box2d.World { + boolean contactFilter(long, long); + void beginContact(long); + void endContact(long); + void preSolve(long, long); + void postSolve(long, long); + boolean reportFixture(long); + float reportRayFixture(long, float, float, float, float, float); +} diff --git a/android/project.properties b/android/project.properties new file mode 100644 index 0000000..3fefa92 --- /dev/null +++ b/android/project.properties @@ -0,0 +1,9 @@ +# This file is used by the Eclipse ADT plugin. It is unnecessary for IDEA and Android Studio projects, which +# configure Proguard and the Android target via the build.gradle file. + +# To enable ProGuard to work with Eclipse ADT, uncomment this (available properties: sdk.dir, user.home) +# and ensure proguard.jar in the Android SDK is up to date (or alternately reduce the android target to 23 or lower): +# proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-rules.pro + +# Project target. +target=android-19 diff --git a/android/res/drawable-hdpi/maxon.png b/android/res/drawable-hdpi/maxon.png Binary files differnew file mode 100644 index 0000000..8ed0628 --- /dev/null +++ b/android/res/drawable-hdpi/maxon.png diff --git a/android/res/drawable-mdpi/maxon.png b/android/res/drawable-mdpi/maxon.png Binary files differnew file mode 100644 index 0000000..f195939 --- /dev/null +++ b/android/res/drawable-mdpi/maxon.png diff --git a/android/res/drawable-xhdpi/maxon.png b/android/res/drawable-xhdpi/maxon.png Binary files differnew file mode 100644 index 0000000..5c1bdb2 --- /dev/null +++ b/android/res/drawable-xhdpi/maxon.png diff --git a/android/res/drawable-xxhdpi/maxon.png b/android/res/drawable-xxhdpi/maxon.png Binary files differnew file mode 100644 index 0000000..324d127 --- /dev/null +++ b/android/res/drawable-xxhdpi/maxon.png diff --git a/android/res/drawable-xxxhdpi/maxon.png b/android/res/drawable-xxxhdpi/maxon.png Binary files differnew file mode 100644 index 0000000..e73c52c --- /dev/null +++ b/android/res/drawable-xxxhdpi/maxon.png diff --git a/android/res/values/strings.xml b/android/res/values/strings.xml new file mode 100644 index 0000000..cbe6c20 --- /dev/null +++ b/android/res/values/strings.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + + <string name="app_name">Maxon Petting Simulator</string> + +</resources> diff --git a/android/src/com/ilotterytea/maxoning/AndroidLauncher.java b/android/src/com/ilotterytea/maxoning/AndroidLauncher.java new file mode 100644 index 0000000..f217cb9 --- /dev/null +++ b/android/src/com/ilotterytea/maxoning/AndroidLauncher.java @@ -0,0 +1,16 @@ +package com.ilotterytea.maxoning; + +import android.os.Bundle; + +import com.badlogic.gdx.backends.android.AndroidApplication; +import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration; +import com.ilotterytea.maxoning.MaxonGame; + +public class AndroidLauncher extends AndroidApplication { + @Override + protected void onCreate (Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + AndroidApplicationConfiguration config = new AndroidApplicationConfiguration(); + initialize(new MaxonGame(), config); + } +} diff --git a/build.gradle b/build.gradle index 9845c98..9a0f2ce 100644 --- a/build.gradle +++ b/build.gradle @@ -9,7 +9,7 @@ buildscript { google() } dependencies { - //classpath 'com.android.tools.build:gradle:7.0.4' + classpath 'com.android.tools.build:gradle:7.0.4' } } @@ -49,11 +49,15 @@ project(":desktop") { implementation project(":core") api "com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion" api "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" - + api "com.badlogicgames.gdx-controllers:gdx-controllers-desktop:$gdxControllersVersion" + api "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop" + api "de.golfgl.gdxgamesvcs:gdx-gamesvcs-core-gamejolt:1.1.0" + api "de.tomgrill.gdxdialogs:gdx-dialogs-desktop:1.3.0" + } } -/*project(":android") { +project(":android") { apply plugin: "com.android.application" configurations { natives } @@ -65,9 +69,19 @@ project(":desktop") { natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a" natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86" natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64" - + api "com.badlogicgames.gdx-controllers:gdx-controllers-android:$gdxControllersVersion" + api "com.badlogicgames.gdx:gdx-box2d:$gdxVersion" + natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi-v7a" + natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-arm64-v8a" + natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86" + natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86_64" + api "com.badlogicgames.box2dlights:box2dlights:$box2DLightsVersion" + api "com.badlogicgames.gdx:gdx-ai:$aiVersion" + api "com.badlogicgames.ashley:ashley:$ashleyVersion" + api "de.golfgl.gdxgamesvcs:gdx-gamesvcs-android-gpgs:1.1.0" + api "de.tomgrill.gdxdialogs:gdx-dialogs-android:1.3.0" } -}*/ +} project(":core") { apply plugin: "java-library" @@ -75,6 +89,13 @@ project(":core") { dependencies { api "com.badlogicgames.gdx:gdx:$gdxVersion" + api "com.badlogicgames.gdx-controllers:gdx-controllers-core:$gdxControllersVersion" + api "com.badlogicgames.gdx:gdx-box2d:$gdxVersion" + api "com.badlogicgames.box2dlights:box2dlights:$box2DLightsVersion" + api "com.badlogicgames.gdx:gdx-ai:$aiVersion" + api "com.badlogicgames.ashley:ashley:$ashleyVersion" + api "de.golfgl.gdxgamesvcs:gdx-gamesvcs-core:1.1.0" + api "de.tomgrill.gdxdialogs:gdx-dialogs-core:1.3.0" api "com.rafaskoberg.gdx:typing-label:$typingLabelVersion" implementation 'com.google.code.gson:gson:2.9.1' implementation 'ch.qos.logback:logback-classic:1.2.10' |
