Create simple drop game

This commit is contained in:
2026-02-06 11:22:38 +00:00
parent 84958b2304
commit cbace1e07e
36 changed files with 1161 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-feature android:glEsVersion="0x00020000" android:required="true"/>
<application
android:allowBackup="true"
android:fullBackupContent="true"
android:icon="@drawable/ic_launcher"
android:isGame="true"
android:appCategory="game"
android:label="@string/app_name"
tools:ignore="UnusedAttribute"
android:theme="@style/GdxTheme">
<activity
android:name="com.badlogic.drop.android.AndroidLauncher"
android:label="@string/app_name"
android:screenOrientation="landscape"
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>

View File

@@ -0,0 +1,136 @@
buildscript {
repositories {
mavenCentral()
google()
}
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
android {
namespace = "com.badlogic.drop"
compileSdk = 35
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.setSrcDirs(['src/main/java', 'src/main/kotlin'])
aidl.setSrcDirs(['src/main/java', 'src/main/kotlin'])
renderscript.setSrcDirs(['src/main/java', 'src/main/kotlin'])
res.setSrcDirs(['res'])
assets.setSrcDirs(['../assets'])
jniLibs.setSrcDirs(['libs'])
}
}
packagingOptions {
resources {
excludes += ['META-INF/robovm/ios/robovm.xml', 'META-INF/DEPENDENCIES.txt', 'META-INF/DEPENDENCIES',
'META-INF/dependencies.txt', '**/*.gwt.xml']
pickFirsts += ['META-INF/LICENSE.txt', 'META-INF/LICENSE', 'META-INF/license.txt', 'META-INF/LGPL2.1',
'META-INF/NOTICE.txt', 'META-INF/NOTICE', 'META-INF/notice.txt']
}
}
defaultConfig {
applicationId 'com.badlogic.drop'
minSdkVersion 21
targetSdkVersion 35
versionCode 1
versionName "1.0"
}
compileOptions {
sourceCompatibility "8"
targetCompatibility "8"
coreLibraryDesugaringEnabled = true
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
kotlin.compilerOptions.jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_1_8)
}
repositories {
// needed for AAPT2, may be needed for other tools
google()
}
configurations { natives }
dependencies {
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.5'
implementation "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
implementation project(':core')
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-arm64-v8a"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86_64"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-arm64-v8a"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86_64"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64"
}
// 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.
tasks.register('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-armeabi-v7a.jar")) outputDir = file("libs/armeabi-v7a")
if(jar.name.endsWith("natives-arm64-v8a.jar")) outputDir = file("libs/arm64-v8a")
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.matching { it.name.contains("merge") && it.name.contains("JniLibFolders") }.configureEach { packageTask ->
packageTask.dependsOn 'copyAndroidNatives'
}
tasks.register('run', 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_SDK_ROOT"
}
} else {
path = "$System.env.ANDROID_SDK_ROOT"
}
def adb = path + "/platform-tools/adb"
commandLine "$adb", 'shell', 'am', 'start', '-n', 'com.badlogic.drop/com.badlogic.drop.android.AndroidLauncher'
}
eclipse.project.name = appName + "-android"

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

View File

@@ -0,0 +1,52 @@
# 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
# https://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
# Needed by the gdx-controllers official extension.
-keep class com.badlogic.gdx.controllers.android.AndroidControllers
# Needed by the Box2D official extension.
-keepclassmembers class com.badlogic.gdx.physics.box2d.World {
boolean contactFilter(long, long);
boolean getUseDefaultContactFilter();
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);
}
# You will need the next three lines if you use scene2d for UI or gameplay.
# If you don't use scene2d at all, you can remove or comment out the next line:
-keep public class com.badlogic.gdx.scenes.scene2d.** { *; }
# You will need the next two lines if you use BitmapFont or any scene2d.ui text:
-keep public class com.badlogic.gdx.graphics.g2d.BitmapFont { *; }
# You will probably need this line in most cases:
-keep public class com.badlogic.gdx.graphics.Color { *; }
# These two lines are used with mapping files; see https://developer.android.com/build/shrink-code#retracing
-keepattributes LineNumberTable,SourceFile
-renamesourcefileattribute SourceFile

View File

@@ -0,0 +1,14 @@
# 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 edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-rules.pro
# Project target.
target=android-21

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon
xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_background_color"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>

View File

@@ -0,0 +1,28 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="512dp"
android:height="512dp"
android:viewportWidth="512"
android:viewportHeight="512">
<path
android:pathData="M457.78,372.5l-201.78,116.5l-201.78,-116.5l0,-233l201.78,-116.5l201.78,116.5z"
android:strokeWidth="23"
android:fillColor="#4a4a4a"
android:strokeColor="#000000"/>
<group>
<clip-path
android:pathData="M449.71,363.84l-193.71,111.84l-193.71,-111.84l0,-223.68l193.71,-111.84l193.71,111.84z"/>
<path
android:pathData="M256,67.33c-0.36,0.13 -1.07,0.4 -2,0.99 -1.67,1.07 -3.94,2.89 -6.4,5.26 -4.93,4.75 -10.72,11.66 -16.1,19.34a142.77,142.77 0,0 0,-2.95 4.41c9.43,-1.86 18.44,-2.8 27.45,-2.8 9.01,0 18.03,0.94 27.45,2.8a142.77,142.77 135,0 0,-2.95 -4.41c-5.38,-7.68 -11.17,-14.6 -16.1,-19.34 -2.46,-2.37 -4.73,-4.2 -6.4,-5.26a9.93,9.93 135,0 0,-2 -0.99zM256,108.66c-11.75,0 -23.5,1.9 -36.98,5.69C214.74,123.36 212,131.66 212,136.8l0,127.71c4.08,-13.81 7.7,-30.59 11.2,-51.52L223.2,200.8c0,-8.8 3.65,-18.74 9.03,-27.7 2.69,-4.48 5.85,-8.63 9.66,-11.94C245.69,157.86 250.4,155.2 256,155.2s10.31,2.66 14.12,5.96c3.81,3.3 6.97,7.45 9.66,11.94C285.15,182.06 288.8,192 288.8,200.8l0,12.19c3.5,20.94 7.12,37.71 11.2,51.52L300,136.8c0,-5.14 -2.74,-13.44 -7.02,-22.45 -13.47,-3.79 -25.23,-5.69 -36.98,-5.69zM185.6,150.71c-5.21,9.21 -12,23.48 -12,37.29l0,31.2l24,0l0,-31.2c0,-13.81 -6.79,-28.08 -12,-37.29zM326.4,150.71c-5.21,9.21 -12,23.48 -12,37.29l0,31.2l24,0l0,-31.2c0,-13.81 -6.79,-28.08 -12,-37.29zM256,169.6c-0.8,0 -2.49,0.54 -4.68,2.44 -2.19,1.9 -4.63,4.95 -6.74,8.46C240.35,187.54 237.6,196.8 237.6,200.8l0,131.02l-2.16,2.12c-8.49,8.33 -10.26,28.91 -10.52,42.22 5.34,2.83 14.26,5.13 23.88,5.94L248.8,341.6l14.4,0l0,40.49c9.62,-0.8 18.54,-3.11 23.88,-5.94 -0.25,-13.27 -1.97,-33.66 -10.57,-42.26L274.4,331.78L274.4,200.8c0,-4 -2.75,-13.26 -6.97,-20.3 -2.11,-3.52 -4.55,-6.57 -6.74,-8.46C258.49,170.14 256.8,169.6 256,169.6zM243.2,193.6l25.6,0l0,14.4l-25.6,0l0,-14.4zM173.6,233.6l0,93.05c9.94,-8.52 17.6,-17.06 24,-27.75L197.6,233.6l-24,0zM314.4,233.6l0,65.3c6.4,10.69 14.06,19.24 24,27.75L338.4,233.6l-24,0zM223.2,276.78c-2.81,8.32 -5.87,15.8 -9.36,22.54 -7.44,14.41 -16.73,25.6 -28.37,36.03l30.94,1.55c1.73,-3.88 3.94,-7.57 6.78,-10.87l0,-49.24zM288.8,276.78l0,49.28c2.81,3.3 5,6.98 6.72,10.84l31,-1.55c-11.64,-10.42 -20.92,-21.62 -28.37,-36.03 -3.48,-6.74 -6.55,-14.22 -9.36,-22.54zM446.4,289.61c-10.84,4.52 -15.22,15.65 -21.56,33.46 0,0 -36.65,0.34 -42.7,14.05 -6.46,14.65 19.67,43.83 19.67,43.83s-21.71,-6.98 -30.34,-1.69c-9.59,5.88 -13.61,30.87 -13.61,30.87 -2.83,-0.68 -5.52,-1.24 -8.11,-1.71L341.33,383.2l8.53,0l-4.79,-8.77 -42.81,2.14 -0.65,1.2c-0,0.73 -0.01,1.56 -0.01,2.22l0,3.2l5.6,0l-8.53,25.6 17.07,-12.8 4,12.01c-11.83,2.51 -20.44,8.55 -28.72,16.43L281.6,405.6l12.8,0l-10.24,-12.49C275.61,395.79 265.83,396.8 256,396.8c-9.85,0 -19.66,-1.02 -28.22,-3.7L217.6,405.6l12.8,0l-10.31,20.62c-9.71,-4.02 -20.02,-8.02 -30.08,-11.44L196.27,396l17.07,12.8L204.8,383.2l5.6,0l0,-3.2c0,-0.65 -0.01,-1.47 -0.01,-2.18l-0.68,-1.24 -42.82,-2.14 -4.76,8.77l8.53,0l-7.96,23.89c-3.19,-0.65 -6.24,-1.16 -9.1,-1.49 -25.25,-2.9 -31.78,3.71 -46.35,9.93 0,0 13.33,-77.26 -13.35,-94.7 -3.3,-2.16 -7.43,-3.03 -11.99,-2.98 -5.06,0.04 -10.67,1.22 -16.31,2.99L65.6,442.4l189.6,0l0.8,1.6 12.8,-25.6 18.79,9.4c-4.45,4.5 -8.93,9.46 -13.88,14.6L446.4,442.4L446.4,289.61zM168.82,348.93c-4.32,3.9 -5.52,7.7 -5.45,9.24 0.04,0.88 0.19,1 0.41,1.19 0.22,0.19 0.81,0.63 2.63,0.63l0.18,0l44.16,2.21c0.25,-3.58 0.68,-7.33 1.39,-11.11l-43.31,-2.17zM343.18,348.93l-43.35,2.17c0.72,3.78 1.15,7.53 1.41,11.11l44.18,-2.21L345.6,360c1.82,0 2.42,-0.44 2.63,-0.63 0.22,-0.19 0.37,-0.32 0.41,-1.19 0.06,-1.54 -1.14,-5.34 -5.45,-9.24zM179.2,396l5.7,17.09c-7.29,-2.35 -14.35,-4.32 -20.86,-5.72L179.2,396zM332.8,396l16.44,12.33c-7.58,-1.34 -14.17,-1.78 -20.05,-1.5L332.8,396zM243.2,418.4l11.64,23.27c-7.9,-3.74 -18.63,-8.66 -30.68,-13.75L243.2,418.4z"
android:fillColor="#ffda54"/>
</group>
<path
android:pathData="M135.76,190.05L112.46,190.05v-15.61q0,-6.81 -0.77,-8.47 -0.72,-1.72 -3.26,-1.72 -2.88,0 -3.65,2.05 -0.77,2.05 -0.77,8.85v41.61q0,6.53 0.77,8.52 0.77,1.99 3.49,1.99 2.6,0 3.38,-1.99 0.83,-1.99 0.83,-9.35v-11.23h23.3v3.49q0,13.89 -1.99,19.7 -1.94,5.81 -8.69,10.18 -6.7,4.37 -16.55,4.37 -10.24,0 -16.88,-3.71 -6.64,-3.71 -8.8,-10.24 -2.16,-6.59 -2.16,-19.76L80.7,182.58q0,-9.68 0.66,-14.5 0.66,-4.87 3.93,-9.35 3.32,-4.48 9.13,-7.03 5.87,-2.6 13.45,-2.6 10.29,0 16.99,3.98 6.7,3.98 8.8,9.96 2.1,5.92 2.1,18.48zM197.68,150.98v89.59h-23.3v-37.63h-6.97v37.63h-23.3v-89.59h23.3v32.04h6.97v-32.04zM247.27,150.98 L260.6,240.57L236.75,240.57l-1.16,-16.1h-8.36l-1.38,16.1h-24.13l11.84,-89.59zM234.93,208.59q-1.77,-15.22 -3.54,-37.57 -3.54,25.68 -4.43,37.57zM316.6,150.98v89.59h-20.42l-12.12,-40.73v40.73h-19.48v-89.59h19.48l13.06,40.34v-40.34zM379.41,183.96h-23.3v-8.13q0,-7.69 -0.66,-9.63 -0.66,-1.94 -3.15,-1.94 -2.16,0 -2.93,1.66 -0.77,1.66 -0.77,8.52v43q0,6.03 0.77,7.97 0.77,1.88 3.1,1.88 2.55,0 3.43,-2.16 0.94,-2.16 0.94,-8.41v-10.62h-4.7v-13.61h27.28v48.09h-14.66l-2.16,-6.42q-2.38,4.15 -6.03,6.25 -3.6,2.05 -8.52,2.05 -5.87,0 -11.01,-2.82 -5.09,-2.88 -7.75,-7.08 -2.66,-4.21 -3.32,-8.8 -0.66,-4.65 -0.66,-13.89v-26.62q0,-12.84 1.38,-18.65 1.38,-5.81 7.91,-10.62 6.59,-4.87 16.99,-4.87 10.24,0 16.99,4.21 6.75,4.21 8.8,10.02 2.05,5.76 2.05,16.77zM388.43,150.98h38.85v17.93h-15.55v16.99h14.55v17.04h-14.55v19.7h17.1v17.93L388.43,240.57Z"
android:strokeWidth="6.1"
android:fillColor="#f30d0d"
android:strokeColor="#000000"/>
<path
android:pathData="m202.17,286.98v17.93h-13.83v71.66h-23.3v-71.66h-13.78v-17.93zM261.05,286.98v89.59h-23.3v-37.63h-6.97v37.63L207.48,376.57v-89.59h23.3v32.04h6.97v-32.04zM293.69,286.98v89.59h-23.3v-89.59zM352.41,314.09L330.77,314.09v-6.64q0,-4.65 -0.83,-5.92 -0.83,-1.27 -2.77,-1.27 -2.1,0 -3.21,1.72 -1.05,1.72 -1.05,5.2 0,4.48 1.22,6.75 1.16,2.27 6.59,5.48 15.55,9.24 19.59,15.16 4.04,5.92 4.04,19.09 0,9.57 -2.27,14.11 -2.21,4.54 -8.63,7.64 -6.42,3.04 -14.94,3.04 -9.35,0 -15.99,-3.54 -6.59,-3.54 -8.63,-9.02 -2.05,-5.48 -2.05,-15.55v-5.87h21.64v10.9q0,5.04 0.89,6.47 0.94,1.44 3.26,1.44 2.32,0 3.43,-1.83 1.16,-1.83 1.16,-5.42 0,-7.91 -2.16,-10.35 -2.21,-2.43 -10.9,-8.13 -8.69,-5.76 -11.51,-8.36 -2.82,-2.6 -4.7,-7.19 -1.83,-4.59 -1.83,-11.73 0,-10.29 2.6,-15.05 2.66,-4.76 8.52,-7.42 5.87,-2.71 14.17,-2.71 9.08,0 15.44,2.93 6.42,2.93 8.47,7.42 2.1,4.43 2.1,15.11z"
android:strokeWidth="6.1"
android:fillColor="#f30d0d"
android:strokeColor="#000000"/>
</vector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_background_color">#F5A623FF</color>
<color name="background">#FFFFFFFF</color>
</resources>

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Drop</string>
</resources>

View File

@@ -0,0 +1,5 @@
<resources>
<style name="GdxTheme" parent="android:Theme.Material.Light.NoActionBar.Fullscreen">
<item name="android:colorBackground">@color/background</item>
</style>
</resources>

View File

@@ -0,0 +1,18 @@
package com.badlogic.drop.android
import android.os.Bundle
import com.badlogic.gdx.backends.android.AndroidApplication
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration
import com.badlogic.drop.Main
/** Launches the Android application. */
class AndroidLauncher : AndroidApplication() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
initialize(Main(), AndroidApplicationConfiguration().apply {
// Configure your application here.
useImmersiveMode = true // Recommended, but not required.
})
}
}