diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml new file mode 100644 index 0000000..f407058 --- /dev/null +++ b/android/AndroidManifest.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + diff --git a/core/assets/data/level.txt b/android/assets/data/level.txt similarity index 100% rename from core/assets/data/level.txt rename to android/assets/data/level.txt diff --git a/core/assets/fonts/joystix.ttf b/android/assets/fonts/joystix.ttf similarity index 100% rename from core/assets/fonts/joystix.ttf rename to android/assets/fonts/joystix.ttf diff --git a/core/assets/level_background.png b/android/assets/level_background.png similarity index 100% rename from core/assets/level_background.png rename to android/assets/level_background.png diff --git a/core/assets/level_background_win.png b/android/assets/level_background_win.png similarity index 100% rename from core/assets/level_background_win.png rename to android/assets/level_background_win.png diff --git a/core/assets/logo.png b/android/assets/logo.png similarity index 100% rename from core/assets/logo.png rename to android/assets/logo.png diff --git a/core/assets/menu_background.png b/android/assets/menu_background.png similarity index 100% rename from core/assets/menu_background.png rename to android/assets/menu_background.png diff --git a/core/assets/sounds/beginning.wav b/android/assets/sounds/beginning.wav similarity index 100% rename from core/assets/sounds/beginning.wav rename to android/assets/sounds/beginning.wav diff --git a/core/assets/sounds/beginning_alt.wav b/android/assets/sounds/beginning_alt.wav similarity index 100% rename from core/assets/sounds/beginning_alt.wav rename to android/assets/sounds/beginning_alt.wav diff --git a/core/assets/sounds/chomp_1.wav b/android/assets/sounds/chomp_1.wav similarity index 100% rename from core/assets/sounds/chomp_1.wav rename to android/assets/sounds/chomp_1.wav diff --git a/core/assets/sounds/chomp_2.wav b/android/assets/sounds/chomp_2.wav similarity index 100% rename from core/assets/sounds/chomp_2.wav rename to android/assets/sounds/chomp_2.wav diff --git a/core/assets/sounds/death.wav b/android/assets/sounds/death.wav similarity index 100% rename from core/assets/sounds/death.wav rename to android/assets/sounds/death.wav diff --git a/core/assets/sounds/eat_fruit.wav b/android/assets/sounds/eat_fruit.wav similarity index 100% rename from core/assets/sounds/eat_fruit.wav rename to android/assets/sounds/eat_fruit.wav diff --git a/core/assets/sounds/eat_ghost.wav b/android/assets/sounds/eat_ghost.wav similarity index 100% rename from core/assets/sounds/eat_ghost.wav rename to android/assets/sounds/eat_ghost.wav diff --git a/core/assets/sounds/extra_life.wav b/android/assets/sounds/extra_life.wav similarity index 100% rename from core/assets/sounds/extra_life.wav rename to android/assets/sounds/extra_life.wav diff --git a/core/assets/sounds/fright.wav b/android/assets/sounds/fright.wav similarity index 100% rename from core/assets/sounds/fright.wav rename to android/assets/sounds/fright.wav diff --git a/core/assets/sounds/intermission.wav b/android/assets/sounds/intermission.wav similarity index 100% rename from core/assets/sounds/intermission.wav rename to android/assets/sounds/intermission.wav diff --git a/core/assets/sounds/return_base.wav b/android/assets/sounds/return_base.wav similarity index 100% rename from core/assets/sounds/return_base.wav rename to android/assets/sounds/return_base.wav diff --git a/core/assets/sounds/siren.wav b/android/assets/sounds/siren.wav similarity index 100% rename from core/assets/sounds/siren.wav rename to android/assets/sounds/siren.wav diff --git a/core/assets/sounds/siren_fast.wav b/android/assets/sounds/siren_fast.wav similarity index 100% rename from core/assets/sounds/siren_fast.wav rename to android/assets/sounds/siren_fast.wav diff --git a/core/assets/sounds/siren_faster.wav b/android/assets/sounds/siren_faster.wav similarity index 100% rename from core/assets/sounds/siren_faster.wav rename to android/assets/sounds/siren_faster.wav diff --git a/core/assets/sounds/siren_fastest.wav b/android/assets/sounds/siren_fastest.wav similarity index 100% rename from core/assets/sounds/siren_fastest.wav rename to android/assets/sounds/siren_fastest.wav diff --git a/core/assets/sprites/death.png b/android/assets/sprites/death.png similarity index 100% rename from core/assets/sprites/death.png rename to android/assets/sprites/death.png diff --git a/core/assets/sprites/death.xcf b/android/assets/sprites/death.xcf similarity index 100% rename from core/assets/sprites/death.xcf rename to android/assets/sprites/death.xcf diff --git a/core/assets/sprites/ghosts.png b/android/assets/sprites/ghosts.png similarity index 100% rename from core/assets/sprites/ghosts.png rename to android/assets/sprites/ghosts.png diff --git a/core/assets/sprites/ghosts.xcf b/android/assets/sprites/ghosts.xcf similarity index 100% rename from core/assets/sprites/ghosts.xcf rename to android/assets/sprites/ghosts.xcf diff --git a/core/assets/sprites/level.png b/android/assets/sprites/level.png similarity index 100% rename from core/assets/sprites/level.png rename to android/assets/sprites/level.png diff --git a/core/assets/sprites/level.xcf b/android/assets/sprites/level.xcf similarity index 100% rename from core/assets/sprites/level.xcf rename to android/assets/sprites/level.xcf diff --git a/core/assets/sprites/pacman.png b/android/assets/sprites/pacman.png similarity index 100% rename from core/assets/sprites/pacman.png rename to android/assets/sprites/pacman.png diff --git a/core/assets/sprites/pacman.xcf b/android/assets/sprites/pacman.xcf similarity index 100% rename from core/assets/sprites/pacman.xcf rename to android/assets/sprites/pacman.xcf diff --git a/core/assets/sprites/points.png b/android/assets/sprites/points.png similarity index 100% rename from core/assets/sprites/points.png rename to android/assets/sprites/points.png diff --git a/core/assets/sprites/points.xcf b/android/assets/sprites/points.xcf similarity index 100% rename from core/assets/sprites/points.xcf rename to android/assets/sprites/points.xcf diff --git a/core/assets/sprites/volume.png b/android/assets/sprites/volume.png similarity index 100% rename from core/assets/sprites/volume.png rename to android/assets/sprites/volume.png diff --git a/core/assets/sprites/volume.xcf b/android/assets/sprites/volume.xcf similarity index 100% rename from core/assets/sprites/volume.xcf rename to android/assets/sprites/volume.xcf diff --git a/android/build.gradle b/android/build.gradle new file mode 100644 index 0000000..5932b0c --- /dev/null +++ b/android/build.gradle @@ -0,0 +1,90 @@ +android { + buildToolsVersion "29.0.2" + compileSdkVersion 29 + 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.me.pacman" + minSdkVersion 14 + targetSdkVersion 29 + versionCode 1 + versionName "1.0" + } + buildTypes { + release { + minifyEnabled false + 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/").mkdirs() + file("libs/armeabi-v7a/").mkdirs() + file("libs/arm64-v8a/").mkdirs() + file("libs/x86_64/").mkdirs() + file("libs/x86/").mkdirs() + + configurations.natives.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-armeabi.jar")) outputDir = file("libs/armeabi") + 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("package")) { + 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.me.pacman/com.me.pacman.AndroidLauncher' +} diff --git a/android/ic_launcher-web.png b/android/ic_launcher-web.png new file mode 100644 index 0000000..dd20c91 Binary files /dev/null and b/android/ic_launcher-web.png differ diff --git a/android/proguard-rules.pro b/android/proguard-rules.pro new file mode 100644 index 0000000..b166b1e --- /dev/null +++ b/android/proguard-rules.pro @@ -0,0 +1,45 @@ +# 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 android.support.** +-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 + +-keep class com.badlogic.gdx.controllers.android.AndroidControllers + +-keepclassmembers class com.badlogic.gdx.backends.android.AndroidInput* { + (com.badlogic.gdx.Application, android.content.Context, java.lang.Object, com.badlogic.gdx.backends.android.AndroidApplicationConfiguration); +} + +-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-anydpi-v26/ic_launcher.xml b/android/res/drawable-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..6c7313a --- /dev/null +++ b/android/res/drawable-anydpi-v26/ic_launcher.xml @@ -0,0 +1,6 @@ + + + + + diff --git a/android/res/drawable-anydpi-v26/ic_launcher_foreground.xml b/android/res/drawable-anydpi-v26/ic_launcher_foreground.xml new file mode 100644 index 0000000..5916ee8 --- /dev/null +++ b/android/res/drawable-anydpi-v26/ic_launcher_foreground.xml @@ -0,0 +1,40 @@ + + + + + + + + + diff --git a/android/res/drawable-hdpi/ic_launcher.png b/android/res/drawable-hdpi/ic_launcher.png new file mode 100644 index 0000000..ab95d20 Binary files /dev/null and b/android/res/drawable-hdpi/ic_launcher.png differ diff --git a/android/res/drawable-mdpi/ic_launcher.png b/android/res/drawable-mdpi/ic_launcher.png new file mode 100644 index 0000000..4513ce1 Binary files /dev/null and b/android/res/drawable-mdpi/ic_launcher.png differ diff --git a/android/res/drawable-xhdpi/ic_launcher.png b/android/res/drawable-xhdpi/ic_launcher.png new file mode 100644 index 0000000..f5bd1d0 Binary files /dev/null and b/android/res/drawable-xhdpi/ic_launcher.png differ diff --git a/android/res/drawable-xxhdpi/ic_launcher.png b/android/res/drawable-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..4635871 Binary files /dev/null and b/android/res/drawable-xxhdpi/ic_launcher.png differ diff --git a/android/res/drawable-xxxhdpi/ic_launcher.png b/android/res/drawable-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..e6d1376 Binary files /dev/null and b/android/res/drawable-xxxhdpi/ic_launcher.png differ diff --git a/android/res/values/color.xml b/android/res/values/color.xml new file mode 100644 index 0000000..933353e --- /dev/null +++ b/android/res/values/color.xml @@ -0,0 +1,4 @@ + + + #FFFFFFFF + diff --git a/android/res/values/strings.xml b/android/res/values/strings.xml new file mode 100644 index 0000000..e1b8dd7 --- /dev/null +++ b/android/res/values/strings.xml @@ -0,0 +1,6 @@ + + + + pac-dude + + diff --git a/android/res/values/styles.xml b/android/res/values/styles.xml new file mode 100644 index 0000000..3f00fc5 --- /dev/null +++ b/android/res/values/styles.xml @@ -0,0 +1,12 @@ + + + + + diff --git a/android/src/com/me/pacman/AndroidLauncher.java b/android/src/com/me/pacman/AndroidLauncher.java new file mode 100644 index 0000000..8fc295d --- /dev/null +++ b/android/src/com/me/pacman/AndroidLauncher.java @@ -0,0 +1,17 @@ +package com.me.pacman; + +import android.os.Bundle; + +import com.badlogic.gdx.backends.android.AndroidApplication; +import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration; +import com.me.pacman.PacDude; + +public class AndroidLauncher extends AndroidApplication { + @Override + protected void onCreate (Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + AndroidApplicationConfiguration config = new AndroidApplicationConfiguration(); + + initialize(new PacDude(), config); + } +} diff --git a/build.gradle b/build.gradle index e14d98a..191d342 100644 --- a/build.gradle +++ b/build.gradle @@ -10,8 +10,7 @@ buildscript { google() } dependencies { - - + classpath 'com.android.tools.build:gradle:3.4.1' } } @@ -49,6 +48,28 @@ project(":desktop") { } } +project(":android") { + apply plugin: "android" + + configurations { natives } + + dependencies { + implementation project(":core") + api "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion" + natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi" + natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a" + 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:gdx-freetype:$gdxVersion" + natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi" + natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi-v7a" + natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-arm64-v8a" + natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86" + natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86_64" + } +} + project(":core") { apply plugin: "java-library" diff --git a/desktop/build.gradle b/desktop/build.gradle index 9a98842..275b6e7 100644 --- a/desktop/build.gradle +++ b/desktop/build.gradle @@ -2,10 +2,10 @@ apply plugin: "java" sourceCompatibility = 1.7 sourceSets.main.java.srcDirs = [ "src/" ] -sourceSets.main.resources.srcDirs = ["../core/assets"] +sourceSets.main.resources.srcDirs = ["../android/assets"] project.ext.mainClassName = "com.me.pacman.desktop.DesktopLauncher" -project.ext.assetsDir = new File("../core/assets") +project.ext.assetsDir = new File("../android/assets") task run(dependsOn: classes, type: JavaExec) { main = project.mainClassName diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 38f14c1..f4d7b2b 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Tue Dec 24 14:05:31 GET 2019 -distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-bin.zip zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/icon.svg b/icon.svg new file mode 100644 index 0000000..971f78e --- /dev/null +++ b/icon.svg @@ -0,0 +1,112 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/settings.gradle b/settings.gradle index 74fc652..e6a9599 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1 @@ -include 'desktop', 'core' \ No newline at end of file +include 'desktop', 'android', 'core'