(com.badlogic.gdx.Application, android.content.Context, java.lang.Object, com.badlogic.gdx.backends.android.AndroidApplicationConfiguration);
-}
-
+# Needed by the Box2D official extension.
-keepclassmembers class com.badlogic.gdx.physics.box2d.World {
boolean contactFilter(long, long);
void beginContact(long);
@@ -43,3 +37,15 @@
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
diff --git a/android/project.properties b/android/project.properties
index 3fefa92..aab9a82 100644
--- a/android/project.properties
+++ b/android/project.properties
@@ -1,9 +1,14 @@
-# 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
+# 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-19
diff --git a/android/res/drawable-hdpi/ic_launcher.png b/android/res/drawable-hdpi/ic_launcher.png
index 91f696b..471928e 100644
Binary files a/android/res/drawable-hdpi/ic_launcher.png 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
index c1ab239..9625ae2 100644
Binary files a/android/res/drawable-mdpi/ic_launcher.png 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
index 2011cc0..025942d 100644
Binary files a/android/res/drawable-xhdpi/ic_launcher.png 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
index 25fcef0..ecbec7b 100644
Binary files a/android/res/drawable-xxhdpi/ic_launcher.png 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
index d109946..d9a4e54 100644
Binary files a/android/res/drawable-xxxhdpi/ic_launcher.png 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..c3d3cfc
--- /dev/null
+++ b/android/res/values/color.xml
@@ -0,0 +1,4 @@
+
+
+ #F5A623FF
+
diff --git a/android/res/values/strings.xml b/android/res/values/strings.xml
index ba1104a..5d50709 100644
--- a/android/res/values/strings.xml
+++ b/android/res/values/strings.xml
@@ -1,6 +1,4 @@
-
- colorrunner
-
+ ColorRunner
diff --git a/android/res/values/styles.xml b/android/res/values/styles.xml
index 3f00fc5..ce3571e 100644
--- a/android/res/values/styles.xml
+++ b/android/res/values/styles.xml
@@ -1,12 +1,10 @@
-
-
diff --git a/android/src/de/samdev/colorrunner/AndroidLauncher.java b/android/src/de/samdev/colorrunner/AndroidLauncher.java
deleted file mode 100644
index cd6f603..0000000
--- a/android/src/de/samdev/colorrunner/AndroidLauncher.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package de.samdev.colorrunner;
-
-import android.os.Bundle;
-
-import com.badlogic.gdx.backends.android.AndroidApplication;
-import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
-
-public class AndroidLauncher extends AndroidApplication {
- @Override
- protected void onCreate (Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
- initialize(new CRGame(), config);
- }
-}
diff --git a/android/src/main/java/de/samdev/colorrunner/android/AndroidLauncher.java b/android/src/main/java/de/samdev/colorrunner/android/AndroidLauncher.java
new file mode 100644
index 0000000..887cf47
--- /dev/null
+++ b/android/src/main/java/de/samdev/colorrunner/android/AndroidLauncher.java
@@ -0,0 +1,18 @@
+package de.samdev.colorrunner.android;
+
+import android.os.Bundle;
+
+import com.badlogic.gdx.backends.android.AndroidApplication;
+import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
+import de.samdev.colorrunner.CRGame;
+
+/** Launches the Android application. */
+public class AndroidLauncher extends AndroidApplication {
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ AndroidApplicationConfiguration configuration = new AndroidApplicationConfiguration();
+ configuration.useImmersiveMode = true; // Recommended, but not required.
+ initialize(new CRGame(), configuration);
+ }
+}
\ No newline at end of file
diff --git a/assets b/assets
new file mode 160000
index 0000000..2271bc3
--- /dev/null
+++ b/assets
@@ -0,0 +1 @@
+Subproject commit 2271bc35d6181e24fe747e90abfff9496b150d69
diff --git a/build.gradle b/build.gradle
index b26865a..81fb05e 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,94 +1,69 @@
buildscript {
-
+ repositories {
+ mavenCentral()
+ maven { url 'https://s01.oss.sonatype.org' }
+ gradlePluginPortal()
+ mavenLocal()
+ google()
+ maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
+ maven { url 'https://s01.oss.sonatype.org/content/repositories/snapshots/' }
+ }
+ dependencies {
+ classpath "com.android.tools.build:gradle:8.1.4"
- repositories {
- mavenLocal()
- mavenCentral()
- maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
- jcenter()
- google()
- }
- dependencies {
- classpath 'com.android.tools.build:gradle:3.0.1'
-
-
- }
+ }
}
allprojects {
- apply plugin: "eclipse"
- apply plugin: "idea"
+ apply plugin: 'eclipse'
+ apply plugin: 'idea'
- version = '1.0'
- ext {
- appName = "colorrunner"
- gdxVersion = '1.9.7'
- roboVMVersion = '2.3.1'
- box2DLightsVersion = '1.4'
- ashleyVersion = '1.7.0'
- aiVersion = '1.8.0'
- }
-
- repositories {
- mavenLocal()
- mavenCentral()
- maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
- maven { url "https://oss.sonatype.org/content/repositories/releases/" }
+ // This allows you to "Build and run using IntelliJ IDEA", an option in IDEA's Settings.
+ idea {
+ module {
+ outputDir file('build/classes/java/main')
+ testOutputDir file('build/classes/java/test')
}
+ }
}
-project(":desktop") {
- apply plugin: "java"
+configure(subprojects - project(':android')) {
+ apply plugin: 'java-library'
+ sourceCompatibility = 11
+ compileJava {
+ options.incremental = true
+ }
+ // From https://lyze.dev/2021/04/29/libGDX-Internal-Assets-List/
+ // The article can be helpful when using assets.txt in your project.
+ compileJava.doLast {
+ // projectFolder/assets
+ def assetsFolder = new File("${project.rootDir}/assets/")
+ // projectFolder/assets/assets.txt
+ def assetsFile = new File(assetsFolder, "assets.txt")
+ // delete that file in case we've already created it
+ assetsFile.delete()
-
- dependencies {
- compile project(":core")
- compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
- compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
-
- }
-}
-
-project(":android") {
- apply plugin: "android"
-
- configurations { natives }
-
- dependencies {
- compile project(":core")
- compile "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"
-
- }
-}
-
-project(":core") {
- apply plugin: "java"
-
-
- dependencies {
- compile "com.badlogicgames.gdx:gdx:$gdxVersion"
-
+ // iterate through all files inside that folder
+ // convert it to a relative path
+ // and append it to the file assets.txt
+ fileTree(assetsFolder).collect { assetsFolder.relativePath(it) }.each {
+ assetsFile.append(it + "\n")
}
+ }
}
subprojects {
- if(it.name != "android") { // android plugin is not compatible with java plugin
- apply plugin: "java"
- apply plugin: "idea"
- idea {
- module {
- scopes.PROVIDED.minus += [configurations.compile]
- scopes.COMPILE.plus += [configurations.compile]
- }
- }
- }
+ version = '1.0.0'
+ ext.appName = 'ColorRunner'
+ repositories {
+ mavenCentral()
+ maven { url 'https://s01.oss.sonatype.org' }
+ // You may want to remove the following line if you have errors downloading dependencies.
+ mavenLocal()
+ maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
+ maven { url 'https://s01.oss.sonatype.org/content/repositories/snapshots/' }
+ maven { url 'https://jitpack.io' }
+ }
}
-tasks.eclipse.doLast {
- delete ".project"
-}
\ No newline at end of file
+eclipse.project.name = 'ColorRunner' + '-parent'
diff --git a/core/build.gradle b/core/build.gradle
index 03cd1be..312768a 100644
--- a/core/build.gradle
+++ b/core/build.gradle
@@ -1,11 +1,7 @@
-apply plugin: "java"
-
-sourceCompatibility = 1.6
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
+eclipse.project.name = appName + '-core'
-sourceSets.main.java.srcDirs = [ "src/" ]
-
-
-eclipse.project {
- name = appName + "-core"
+dependencies {
+ api "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
+ api "com.badlogicgames.gdx:gdx:$gdxVersion"
}
diff --git a/core/src/de/samdev/colorrunner/CRGame.java b/core/src/main/java/de/samdev/colorrunner/CRGame.java
similarity index 100%
rename from core/src/de/samdev/colorrunner/CRGame.java
rename to core/src/main/java/de/samdev/colorrunner/CRGame.java
diff --git a/core/src/de/samdev/colorrunner/game/renderer/AbstractGameRenderer.java b/core/src/main/java/de/samdev/colorrunner/game/renderer/AbstractGameRenderer.java
similarity index 100%
rename from core/src/de/samdev/colorrunner/game/renderer/AbstractGameRenderer.java
rename to core/src/main/java/de/samdev/colorrunner/game/renderer/AbstractGameRenderer.java
diff --git a/core/src/de/samdev/colorrunner/game/renderer/CRAssets.java b/core/src/main/java/de/samdev/colorrunner/game/renderer/CRAssets.java
similarity index 100%
rename from core/src/de/samdev/colorrunner/game/renderer/CRAssets.java
rename to core/src/main/java/de/samdev/colorrunner/game/renderer/CRAssets.java
diff --git a/core/src/de/samdev/colorrunner/game/renderer/CRGameRenderer.java b/core/src/main/java/de/samdev/colorrunner/game/renderer/CRGameRenderer.java
similarity index 100%
rename from core/src/de/samdev/colorrunner/game/renderer/CRGameRenderer.java
rename to core/src/main/java/de/samdev/colorrunner/game/renderer/CRGameRenderer.java
diff --git a/core/src/de/samdev/colorrunner/game/world/AverageExecutionLogger.java b/core/src/main/java/de/samdev/colorrunner/game/world/AverageExecutionLogger.java
similarity index 100%
rename from core/src/de/samdev/colorrunner/game/world/AverageExecutionLogger.java
rename to core/src/main/java/de/samdev/colorrunner/game/world/AverageExecutionLogger.java
diff --git a/core/src/de/samdev/colorrunner/game/world/CRGameWorld.java b/core/src/main/java/de/samdev/colorrunner/game/world/CRGameWorld.java
similarity index 100%
rename from core/src/de/samdev/colorrunner/game/world/CRGameWorld.java
rename to core/src/main/java/de/samdev/colorrunner/game/world/CRGameWorld.java
diff --git a/core/src/de/samdev/colorrunner/game/world/FPSCounter.java b/core/src/main/java/de/samdev/colorrunner/game/world/FPSCounter.java
similarity index 100%
rename from core/src/de/samdev/colorrunner/game/world/FPSCounter.java
rename to core/src/main/java/de/samdev/colorrunner/game/world/FPSCounter.java
diff --git a/core/src/de/samdev/colorrunner/game/world/SwipeDirection.java b/core/src/main/java/de/samdev/colorrunner/game/world/SwipeDirection.java
similarity index 100%
rename from core/src/de/samdev/colorrunner/game/world/SwipeDirection.java
rename to core/src/main/java/de/samdev/colorrunner/game/world/SwipeDirection.java
diff --git a/core/src/de/samdev/colorrunner/game/world/entities/CRGameEntity.java b/core/src/main/java/de/samdev/colorrunner/game/world/entities/CRGameEntity.java
similarity index 100%
rename from core/src/de/samdev/colorrunner/game/world/entities/CRGameEntity.java
rename to core/src/main/java/de/samdev/colorrunner/game/world/entities/CRGameEntity.java
diff --git a/core/src/de/samdev/colorrunner/game/world/entities/MovingEntity.java b/core/src/main/java/de/samdev/colorrunner/game/world/entities/MovingEntity.java
similarity index 100%
rename from core/src/de/samdev/colorrunner/game/world/entities/MovingEntity.java
rename to core/src/main/java/de/samdev/colorrunner/game/world/entities/MovingEntity.java
diff --git a/core/src/de/samdev/colorrunner/game/world/entities/StaticEntity.java b/core/src/main/java/de/samdev/colorrunner/game/world/entities/StaticEntity.java
similarity index 100%
rename from core/src/de/samdev/colorrunner/game/world/entities/StaticEntity.java
rename to core/src/main/java/de/samdev/colorrunner/game/world/entities/StaticEntity.java
diff --git a/core/src/de/samdev/colorrunner/game/world/entities/gameentities/ControllingType.java b/core/src/main/java/de/samdev/colorrunner/game/world/entities/gameentities/ControllingType.java
similarity index 100%
rename from core/src/de/samdev/colorrunner/game/world/entities/gameentities/ControllingType.java
rename to core/src/main/java/de/samdev/colorrunner/game/world/entities/gameentities/ControllingType.java
diff --git a/core/src/de/samdev/colorrunner/game/world/entities/gameentities/PlayerEntity.java b/core/src/main/java/de/samdev/colorrunner/game/world/entities/gameentities/PlayerEntity.java
similarity index 100%
rename from core/src/de/samdev/colorrunner/game/world/entities/gameentities/PlayerEntity.java
rename to core/src/main/java/de/samdev/colorrunner/game/world/entities/gameentities/PlayerEntity.java
diff --git a/core/src/de/samdev/colorrunner/game/world/entities/gameentities/controller/AbstractPlayerController.java b/core/src/main/java/de/samdev/colorrunner/game/world/entities/gameentities/controller/AbstractPlayerController.java
similarity index 100%
rename from core/src/de/samdev/colorrunner/game/world/entities/gameentities/controller/AbstractPlayerController.java
rename to core/src/main/java/de/samdev/colorrunner/game/world/entities/gameentities/controller/AbstractPlayerController.java
diff --git a/core/src/de/samdev/colorrunner/game/world/entities/gameentities/controller/FlyPlayerController.java b/core/src/main/java/de/samdev/colorrunner/game/world/entities/gameentities/controller/FlyPlayerController.java
similarity index 100%
rename from core/src/de/samdev/colorrunner/game/world/entities/gameentities/controller/FlyPlayerController.java
rename to core/src/main/java/de/samdev/colorrunner/game/world/entities/gameentities/controller/FlyPlayerController.java
diff --git a/core/src/de/samdev/colorrunner/game/world/entities/gameentities/controller/GravityPlayerController.java b/core/src/main/java/de/samdev/colorrunner/game/world/entities/gameentities/controller/GravityPlayerController.java
similarity index 100%
rename from core/src/de/samdev/colorrunner/game/world/entities/gameentities/controller/GravityPlayerController.java
rename to core/src/main/java/de/samdev/colorrunner/game/world/entities/gameentities/controller/GravityPlayerController.java
diff --git a/core/src/de/samdev/colorrunner/game/world/entities/gameentities/controller/RunBottomPlayerController.java b/core/src/main/java/de/samdev/colorrunner/game/world/entities/gameentities/controller/RunBottomPlayerController.java
similarity index 100%
rename from core/src/de/samdev/colorrunner/game/world/entities/gameentities/controller/RunBottomPlayerController.java
rename to core/src/main/java/de/samdev/colorrunner/game/world/entities/gameentities/controller/RunBottomPlayerController.java
diff --git a/core/src/de/samdev/colorrunner/game/world/entities/gameentities/controller/RunTopPlayerController.java b/core/src/main/java/de/samdev/colorrunner/game/world/entities/gameentities/controller/RunTopPlayerController.java
similarity index 100%
rename from core/src/de/samdev/colorrunner/game/world/entities/gameentities/controller/RunTopPlayerController.java
rename to core/src/main/java/de/samdev/colorrunner/game/world/entities/gameentities/controller/RunTopPlayerController.java
diff --git a/core/src/de/samdev/colorrunner/game/world/entities/gameentities/floor/DownStateFloorTileEntity.java b/core/src/main/java/de/samdev/colorrunner/game/world/entities/gameentities/floor/DownStateFloorTileEntity.java
similarity index 100%
rename from core/src/de/samdev/colorrunner/game/world/entities/gameentities/floor/DownStateFloorTileEntity.java
rename to core/src/main/java/de/samdev/colorrunner/game/world/entities/gameentities/floor/DownStateFloorTileEntity.java
diff --git a/core/src/de/samdev/colorrunner/game/world/entities/gameentities/floor/FloorTileEntity.java b/core/src/main/java/de/samdev/colorrunner/game/world/entities/gameentities/floor/FloorTileEntity.java
similarity index 100%
rename from core/src/de/samdev/colorrunner/game/world/entities/gameentities/floor/FloorTileEntity.java
rename to core/src/main/java/de/samdev/colorrunner/game/world/entities/gameentities/floor/FloorTileEntity.java
diff --git a/core/src/de/samdev/colorrunner/game/world/entities/gameentities/floor/LeftStateFloorTileEntity.java b/core/src/main/java/de/samdev/colorrunner/game/world/entities/gameentities/floor/LeftStateFloorTileEntity.java
similarity index 100%
rename from core/src/de/samdev/colorrunner/game/world/entities/gameentities/floor/LeftStateFloorTileEntity.java
rename to core/src/main/java/de/samdev/colorrunner/game/world/entities/gameentities/floor/LeftStateFloorTileEntity.java
diff --git a/core/src/de/samdev/colorrunner/game/world/entities/gameentities/floor/NoStateFloorTileEntity.java b/core/src/main/java/de/samdev/colorrunner/game/world/entities/gameentities/floor/NoStateFloorTileEntity.java
similarity index 100%
rename from core/src/de/samdev/colorrunner/game/world/entities/gameentities/floor/NoStateFloorTileEntity.java
rename to core/src/main/java/de/samdev/colorrunner/game/world/entities/gameentities/floor/NoStateFloorTileEntity.java
diff --git a/core/src/de/samdev/colorrunner/game/world/entities/gameentities/floor/RightStateFloorTileEntity.java b/core/src/main/java/de/samdev/colorrunner/game/world/entities/gameentities/floor/RightStateFloorTileEntity.java
similarity index 100%
rename from core/src/de/samdev/colorrunner/game/world/entities/gameentities/floor/RightStateFloorTileEntity.java
rename to core/src/main/java/de/samdev/colorrunner/game/world/entities/gameentities/floor/RightStateFloorTileEntity.java
diff --git a/core/src/de/samdev/colorrunner/game/world/entities/gameentities/floor/UpStateFloorTileEntity.java b/core/src/main/java/de/samdev/colorrunner/game/world/entities/gameentities/floor/UpStateFloorTileEntity.java
similarity index 100%
rename from core/src/de/samdev/colorrunner/game/world/entities/gameentities/floor/UpStateFloorTileEntity.java
rename to core/src/main/java/de/samdev/colorrunner/game/world/entities/gameentities/floor/UpStateFloorTileEntity.java
diff --git a/core/src/de/samdev/colorrunner/game/world/map/CRMapStorage.java b/core/src/main/java/de/samdev/colorrunner/game/world/map/CRMapStorage.java
similarity index 100%
rename from core/src/de/samdev/colorrunner/game/world/map/CRMapStorage.java
rename to core/src/main/java/de/samdev/colorrunner/game/world/map/CRMapStorage.java
diff --git a/core/src/de/samdev/colorrunner/game/world/map/CRTiledMap.java b/core/src/main/java/de/samdev/colorrunner/game/world/map/CRTiledMap.java
similarity index 100%
rename from core/src/de/samdev/colorrunner/game/world/map/CRTiledMap.java
rename to core/src/main/java/de/samdev/colorrunner/game/world/map/CRTiledMap.java
diff --git a/core/src/de/samdev/colorrunner/game/world/map/MapSection.java b/core/src/main/java/de/samdev/colorrunner/game/world/map/MapSection.java
similarity index 100%
rename from core/src/de/samdev/colorrunner/game/world/map/MapSection.java
rename to core/src/main/java/de/samdev/colorrunner/game/world/map/MapSection.java
diff --git a/core/src/de/samdev/colorrunner/game/world/map/provider/EndlessMapProvider.java b/core/src/main/java/de/samdev/colorrunner/game/world/map/provider/EndlessMapProvider.java
similarity index 100%
rename from core/src/de/samdev/colorrunner/game/world/map/provider/EndlessMapProvider.java
rename to core/src/main/java/de/samdev/colorrunner/game/world/map/provider/EndlessMapProvider.java
diff --git a/core/src/de/samdev/colorrunner/game/world/map/provider/MapProvider.java b/core/src/main/java/de/samdev/colorrunner/game/world/map/provider/MapProvider.java
similarity index 100%
rename from core/src/de/samdev/colorrunner/game/world/map/provider/MapProvider.java
rename to core/src/main/java/de/samdev/colorrunner/game/world/map/provider/MapProvider.java
diff --git a/core/src/de/samdev/colorrunner/game/world/map/provider/StaticMapProvider.java b/core/src/main/java/de/samdev/colorrunner/game/world/map/provider/StaticMapProvider.java
similarity index 100%
rename from core/src/de/samdev/colorrunner/game/world/map/provider/StaticMapProvider.java
rename to core/src/main/java/de/samdev/colorrunner/game/world/map/provider/StaticMapProvider.java
diff --git a/core/src/de/samdev/colorrunner/game/world/map/provider/TriggerType.java b/core/src/main/java/de/samdev/colorrunner/game/world/map/provider/TriggerType.java
similarity index 100%
rename from core/src/de/samdev/colorrunner/game/world/map/provider/TriggerType.java
rename to core/src/main/java/de/samdev/colorrunner/game/world/map/provider/TriggerType.java
diff --git a/core/src/de/samdev/colorrunner/input/CRGameInputProcessor.java b/core/src/main/java/de/samdev/colorrunner/input/CRGameInputProcessor.java
similarity index 92%
rename from core/src/de/samdev/colorrunner/input/CRGameInputProcessor.java
rename to core/src/main/java/de/samdev/colorrunner/input/CRGameInputProcessor.java
index 9abd89a..0794195 100644
--- a/core/src/de/samdev/colorrunner/input/CRGameInputProcessor.java
+++ b/core/src/main/java/de/samdev/colorrunner/input/CRGameInputProcessor.java
@@ -18,40 +18,40 @@ public class CRGameInputProcessor implements InputProcessor, GestureListener {
public void update() {
}
-
+
@Override
public boolean keyDown(int keycode) {
if (keycode == Input.Keys.UP) {
owner.switchColor(SwipeDirection.UP);
return true;
}
-
+
if (keycode == Input.Keys.RIGHT) {
owner.switchColor(SwipeDirection.RIGHT);
return true;
}
-
+
if (keycode == Input.Keys.DOWN) {
owner.switchColor(SwipeDirection.DOWN);
return true;
}
-
+
if (keycode == Input.Keys.LEFT) {
owner.switchColor(SwipeDirection.LEFT);
return true;
}
-
+
if (keycode == Input.Keys.SPACE) {
owner.doJump();
return true;
}
-
+
if (keycode == Input.Keys.R && CRGame.DEBUG) {
owner.reset();
return true;
}
-
+
return false;
}
@@ -76,7 +76,12 @@ public class CRGameInputProcessor implements InputProcessor, GestureListener {
return false;
}
- @Override
+ @Override
+ public boolean touchCancelled(int screenX, int screenY, int pointer, int button) {
+ return false;
+ }
+
+ @Override
public boolean touchDragged(int screenX, int screenY, int pointer) {
return false;
}
@@ -86,10 +91,10 @@ public class CRGameInputProcessor implements InputProcessor, GestureListener {
return false;
}
- @Override
- public boolean scrolled(int amount) {
- return false;
- }
+ @Override
+ public boolean scrolled(float amountX, float amountY) {
+ return false;
+ }
@Override
public boolean touchDown(float x, float y, int pointer, int button) {
diff --git a/core/src/de/samdev/colorrunner/input/GameInputListener.java b/core/src/main/java/de/samdev/colorrunner/input/GameInputListener.java
similarity index 100%
rename from core/src/de/samdev/colorrunner/input/GameInputListener.java
rename to core/src/main/java/de/samdev/colorrunner/input/GameInputListener.java
diff --git a/core/src/de/samdev/colorrunner/screens/gameScreen/GameScreen.java b/core/src/main/java/de/samdev/colorrunner/screens/gameScreen/GameScreen.java
similarity index 100%
rename from core/src/de/samdev/colorrunner/screens/gameScreen/GameScreen.java
rename to core/src/main/java/de/samdev/colorrunner/screens/gameScreen/GameScreen.java
diff --git a/core/src/de/samdev/colorrunner/screens/menu/BaseMenu.java b/core/src/main/java/de/samdev/colorrunner/screens/menu/BaseMenu.java
similarity index 88%
rename from core/src/de/samdev/colorrunner/screens/menu/BaseMenu.java
rename to core/src/main/java/de/samdev/colorrunner/screens/menu/BaseMenu.java
index 1e5163d..ad41c88 100644
--- a/core/src/de/samdev/colorrunner/screens/menu/BaseMenu.java
+++ b/core/src/main/java/de/samdev/colorrunner/screens/menu/BaseMenu.java
@@ -1,16 +1,19 @@
package de.samdev.colorrunner.screens.menu;
import com.badlogic.gdx.Gdx;
+import com.badlogic.gdx.InputMultiplexer;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
+import com.badlogic.gdx.input.GestureDetector;
import java.util.ArrayList;
import java.util.List;
import de.samdev.colorrunner.CRGame;
+import de.samdev.colorrunner.input.CRGameInputProcessor;
public abstract class BaseMenu implements Screen {
@@ -22,6 +25,8 @@ public abstract class BaseMenu implements Screen {
private SpriteBatch sbatch = new SpriteBatch();
private ShapeRenderer linebatch = new ShapeRenderer();
+ private CRMenuInputProcessor input = new CRMenuInputProcessor(this);
+
public BaseMenu() {
super();
@@ -39,7 +44,7 @@ public abstract class BaseMenu implements Screen {
@Override
public void show() {
- // NOP
+ Gdx.input.setInputProcessor(new InputMultiplexer(input, new GestureDetector(input)));
}
@Override
@@ -137,4 +142,8 @@ public abstract class BaseMenu implements Screen {
public void dispose() {
}
+
+ public void touchDown(int screenX, int screenY) {
+ //
+ }
}
diff --git a/core/src/de/samdev/colorrunner/screens/menu/BaseMenuElement.java b/core/src/main/java/de/samdev/colorrunner/screens/menu/BaseMenuElement.java
similarity index 100%
rename from core/src/de/samdev/colorrunner/screens/menu/BaseMenuElement.java
rename to core/src/main/java/de/samdev/colorrunner/screens/menu/BaseMenuElement.java
diff --git a/core/src/main/java/de/samdev/colorrunner/screens/menu/CRMenuInputProcessor.java b/core/src/main/java/de/samdev/colorrunner/screens/menu/CRMenuInputProcessor.java
new file mode 100644
index 0000000..14bbe2f
--- /dev/null
+++ b/core/src/main/java/de/samdev/colorrunner/screens/menu/CRMenuInputProcessor.java
@@ -0,0 +1,105 @@
+package de.samdev.colorrunner.screens.menu;
+
+import com.badlogic.gdx.InputProcessor;
+import com.badlogic.gdx.input.GestureDetector;
+import com.badlogic.gdx.math.Vector2;
+
+public class CRMenuInputProcessor implements InputProcessor, GestureDetector.GestureListener {
+
+ private final BaseMenu owner;
+
+ public CRMenuInputProcessor(BaseMenu m) {
+ owner = m;
+ }
+
+ @Override
+ public boolean keyDown(int keycode) {
+ return false;
+ }
+
+ @Override
+ public boolean keyUp(int keycode) {
+ return false;
+ }
+
+ @Override
+ public boolean keyTyped(char character) {
+ return false;
+ }
+
+ @Override
+ public boolean touchDown(int screenX, int screenY, int pointer, int button) {
+ owner.touchDown(screenX, screenY);
+ return false;
+ }
+
+ @Override
+ public boolean touchUp(int screenX, int screenY, int pointer, int button) {
+ return false;
+ }
+
+ @Override
+ public boolean touchCancelled(int screenX, int screenY, int pointer, int button) {
+ return false;
+ }
+
+ @Override
+ public boolean touchDragged(int screenX, int screenY, int pointer) {
+ return false;
+ }
+
+ @Override
+ public boolean mouseMoved(int screenX, int screenY) {
+ return false;
+ }
+
+ @Override
+ public boolean scrolled(float amountX, float amountY) {
+ return false;
+ }
+
+ @Override
+ public boolean touchDown(float x, float y, int pointer, int button) {
+ return false;
+ }
+
+ @Override
+ public boolean tap(float x, float y, int count, int button) {
+ return false;
+ }
+
+ @Override
+ public boolean longPress(float x, float y) {
+ return false;
+ }
+
+ @Override
+ public boolean fling(float velocityX, float velocityY, int button) {
+ return false;
+ }
+
+ @Override
+ public boolean pan(float x, float y, float deltaX, float deltaY) {
+ return false;
+ }
+
+ @Override
+ public boolean panStop(float x, float y, int pointer, int button) {
+ return false;
+ }
+
+ @Override
+ public boolean zoom(float initialDistance, float distance) {
+ return false;
+ }
+
+ @Override
+ public boolean pinch(Vector2 initialPointer1, Vector2 initialPointer2, Vector2 pointer1, Vector2 pointer2) {
+ return false;
+ }
+
+ @Override
+ public void pinchStop() {
+
+ }
+}
diff --git a/core/src/de/samdev/colorrunner/screens/menu/impl/LevelSelectMenu.java b/core/src/main/java/de/samdev/colorrunner/screens/menu/impl/LevelSelectMenu.java
similarity index 55%
rename from core/src/de/samdev/colorrunner/screens/menu/impl/LevelSelectMenu.java
rename to core/src/main/java/de/samdev/colorrunner/screens/menu/impl/LevelSelectMenu.java
index 855e4c0..d1c949a 100644
--- a/core/src/de/samdev/colorrunner/screens/menu/impl/LevelSelectMenu.java
+++ b/core/src/main/java/de/samdev/colorrunner/screens/menu/impl/LevelSelectMenu.java
@@ -2,6 +2,10 @@ package de.samdev.colorrunner.screens.menu.impl;
import com.badlogic.gdx.graphics.Color;
+import de.samdev.colorrunner.CRGame;
+import de.samdev.colorrunner.game.world.map.provider.EndlessMapProvider;
+import de.samdev.colorrunner.game.world.map.provider.MapProvider;
+import de.samdev.colorrunner.screens.gameScreen.GameScreen;
import de.samdev.colorrunner.screens.menu.BaseMenu;
import de.samdev.colorrunner.screens.menu.impl.elements.CRMenuRectangle;
@@ -19,4 +23,9 @@ public class LevelSelectMenu extends BaseMenu {
}
+ @Override
+ public void touchDown(int screenX, int screenY) {
+ CRGame.Inst().setScreen(new GameScreen(new EndlessMapProvider(System.currentTimeMillis())));
+ }
}
+
diff --git a/core/src/de/samdev/colorrunner/screens/menu/impl/SplashScreen.java b/core/src/main/java/de/samdev/colorrunner/screens/menu/impl/SplashScreen.java
similarity index 93%
rename from core/src/de/samdev/colorrunner/screens/menu/impl/SplashScreen.java
rename to core/src/main/java/de/samdev/colorrunner/screens/menu/impl/SplashScreen.java
index cbc3dd7..e2009ef 100644
--- a/core/src/de/samdev/colorrunner/screens/menu/impl/SplashScreen.java
+++ b/core/src/main/java/de/samdev/colorrunner/screens/menu/impl/SplashScreen.java
@@ -15,14 +15,14 @@ import de.samdev.colorrunner.CRGame;
public class SplashScreen implements Screen {
private float loadTime = 0;
-
+
private int random = MathUtils.random(5);
private Texture logo = new Texture("images/blackforestbytes_appstart.png");
-
+
private OrthographicCamera cam = new OrthographicCamera();
private SpriteBatch sB;
-
+
@Override
public void render(float delta) {
Gdx.gl.glClearColor(1, 1, 1, 1); //Weiß
@@ -33,50 +33,49 @@ public class SplashScreen implements Screen {
sB.end();
loadTime += delta;
- if (loadTime > 0.9)
- CRGame.Inst().setScreen(new LevelSelectMenu());
+ if (loadTime > 0.9) CRGame.Inst().setScreen(new LevelSelectMenu());
}
@Override
public void resize(int width, int height) {
// NOP
-
+
}
@Override
public void show() {
-
+
sB = new SpriteBatch();
this.cam = new OrthographicCamera(20,40);
this.cam.position.set(20 / 2, 40 / 2, 0);
sB.setProjectionMatrix(cam.combined);
cam.update();
-
+
}
@Override
public void hide() {
dispose();
-
+
}
@Override
public void pause() {
// NOP
-
+
}
@Override
public void resume() {
// NOP
-
+
}
@Override
public void dispose() {
logo.dispose();
-
+
}
}
diff --git a/core/src/de/samdev/colorrunner/screens/menu/impl/elements/CRMenuRectangle.java b/core/src/main/java/de/samdev/colorrunner/screens/menu/impl/elements/CRMenuRectangle.java
similarity index 93%
rename from core/src/de/samdev/colorrunner/screens/menu/impl/elements/CRMenuRectangle.java
rename to core/src/main/java/de/samdev/colorrunner/screens/menu/impl/elements/CRMenuRectangle.java
index 3349018..1e922ab 100644
--- a/core/src/de/samdev/colorrunner/screens/menu/impl/elements/CRMenuRectangle.java
+++ b/core/src/main/java/de/samdev/colorrunner/screens/menu/impl/elements/CRMenuRectangle.java
@@ -23,7 +23,7 @@ public class CRMenuRectangle extends BaseMenuElement {
batch.setColor(Color);
batch.draw(CRAssets.TEX_BLANK, Bounds.x, Bounds.y, Bounds.width, Bounds.height);
- batch.setColor(0);
+ batch.setColor(com.badlogic.gdx.graphics.Color.BLACK);
}
diff --git a/desktop/build.gradle b/desktop/build.gradle
deleted file mode 100644
index f4a667b..0000000
--- a/desktop/build.gradle
+++ /dev/null
@@ -1,55 +0,0 @@
-apply plugin: "java"
-
-sourceCompatibility = 1.6
-sourceSets.main.java.srcDirs = [ "src/" ]
-
-project.ext.mainClassName = "de.samdev.colorrunner.desktop.DesktopLauncher"
-project.ext.assetsDir = new File("../android/assets");
-
-task run(dependsOn: classes, type: JavaExec) {
- main = project.mainClassName
- classpath = sourceSets.main.runtimeClasspath
- standardInput = System.in
- workingDir = project.assetsDir
- ignoreExitValue = true
-}
-
-task debug(dependsOn: classes, type: JavaExec) {
- main = project.mainClassName
- classpath = sourceSets.main.runtimeClasspath
- standardInput = System.in
- workingDir = project.assetsDir
- ignoreExitValue = true
- debug = true
-}
-
-task dist(type: Jar) {
- from files(sourceSets.main.output.classesDir)
- from files(sourceSets.main.output.resourcesDir)
- from {configurations.compile.collect {zipTree(it)}}
- from files(project.assetsDir);
-
- manifest {
- attributes 'Main-Class': project.mainClassName
- }
-}
-
-dist.dependsOn classes
-
-eclipse {
- project {
- name = appName + "-desktop"
- linkedResource name: 'assets', type: '2', location: 'PARENT-1-PROJECT_LOC/android/assets'
- }
-}
-
-task afterEclipseImport(description: "Post processing after project generation", group: "IDE") {
- doLast {
- def classpath = new XmlParser().parse(file(".classpath"))
- new Node(classpath, "classpathentry", [ kind: 'src', path: 'assets' ]);
- def writer = new FileWriter(file(".classpath"))
- def printer = new XmlNodePrinter(new PrintWriter(writer))
- printer.setPreserveWhitespace(true)
- printer.print(classpath)
- }
-}
diff --git a/desktop/src/de/samdev/colorrunner/desktop/DesktopLauncher.java b/desktop/src/de/samdev/colorrunner/desktop/DesktopLauncher.java
deleted file mode 100644
index d18de39..0000000
--- a/desktop/src/de/samdev/colorrunner/desktop/DesktopLauncher.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package de.samdev.colorrunner.desktop;
-
-import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
-import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
-
-import de.samdev.colorrunner.CRGame;
-
-public class DesktopLauncher {
- public static void main (String[] arg) {
- LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
- config.title = "ColorRunner";
- config.width = 1000;
- config.height = 563;
- new LwjglApplication(new CRGame(), config);
- }
-}
diff --git a/gradle.properties b/gradle.properties
index 339fa15..aed72fd 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,3 +1,7 @@
org.gradle.daemon=true
-org.gradle.jvmargs=-Xms128m -Xmx1500m
-org.gradle.configureondemand=true
+org.gradle.jvmargs=-Xms512M -Xmx1G
+org.gradle.configureondemand=false
+graalHelperVersion=2.0.1
+enableGraalNative=false
+android.enableR8.fullMode=false
+gdxVersion=1.12.1
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
index bafc550..e644113 100644
Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 2fe10aa..a441313 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,7 @@
-#Sat Nov 25 13:49:47 CET 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
+networkTimeout=10000
+validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
diff --git a/gradlew b/gradlew
old mode 100644
new mode 100755
index 4453cce..b740cf1
--- a/gradlew
+++ b/gradlew
@@ -1,78 +1,127 @@
-#!/usr/bin/env sh
+#!/bin/sh
+
+#
+# Copyright © 2015-2021 the original authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
##############################################################################
-##
-## Gradle start up script for UN*X
-##
+#
+# Gradle start up script for POSIX generated by Gradle.
+#
+# Important for running:
+#
+# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
+# noncompliant, but you have some other compliant shell such as ksh or
+# bash, then to run this script, type that shell name before the whole
+# command line, like:
+#
+# ksh Gradle
+#
+# Busybox and similar reduced shells will NOT work, because this script
+# requires all of these POSIX shell features:
+# * functions;
+# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
+# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
+# * compound commands having a testable exit status, especially «case»;
+# * various built-in commands including «command», «set», and «ulimit».
+#
+# Important for patching:
+#
+# (2) This script targets any POSIX shell, so it avoids extensions provided
+# by Bash, Ksh, etc; in particular arrays are avoided.
+#
+# The "traditional" practice of packing multiple parameters into a
+# space-separated string is a well documented source of bugs and security
+# problems, so this is (mostly) avoided, by progressively accumulating
+# options in "$@", and eventually passing that to Java.
+#
+# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
+# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
+# see the in-line comments for details.
+#
+# There are tweaks for specific operating systems such as AIX, CygWin,
+# Darwin, MinGW, and NonStop.
+#
+# (3) This script is generated from the Groovy template
+# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
+# within the Gradle project.
+#
+# You can find Gradle at https://github.com/gradle/gradle/.
+#
##############################################################################
# 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
+app_path=$0
+
+# Need this for daisy-chained symlinks.
+while
+ APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
+ [ -h "$app_path" ]
+do
+ ls=$( ls -ld "$app_path" )
+ link=${ls#*' -> '}
+ case $link in #(
+ /*) app_path=$link ;; #(
+ *) app_path=$APP_HOME$link ;;
+ esac
done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >/dev/null
-APP_HOME="`pwd -P`"
-cd "$SAVED" >/dev/null
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
+# This is normally unused
+# shellcheck disable=SC2034
+APP_BASE_NAME=${0##*/}
+# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
+APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
+MAX_FD=maximum
-warn ( ) {
+warn () {
echo "$*"
-}
+} >&2
-die ( ) {
+die () {
echo
echo "$*"
echo
exit 1
-}
+} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
- NONSTOP* )
- nonstop=true
- ;;
+case "$( uname )" in #(
+ CYGWIN* ) cygwin=true ;; #(
+ Darwin* ) darwin=true ;; #(
+ MSYS* | MINGW* ) msys=true ;; #(
+ NONSTOP* ) nonstop=true ;;
esac
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"
+ JAVACMD=$JAVA_HOME/jre/sh/java
else
- JAVACMD="$JAVA_HOME/bin/java"
+ JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
@@ -81,92 +130,120 @@ 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.
+ JAVACMD=java
+ if ! command -v java >/dev/null 2>&1
+ then
+ 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
fi
# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "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"`
- JAVACMD=`cygpath --unix "$JAVACMD"`
-
- # 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" ;;
+if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
+ case $MAX_FD in #(
+ max*)
+ # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
+ MAX_FD=$( ulimit -H -n ) ||
+ warn "Could not query maximum file descriptor limit"
+ esac
+ case $MAX_FD in #(
+ '' | soft) :;; #(
+ *)
+ # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
+ ulimit -n "$MAX_FD" ||
+ warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
-# Escape application args
-save ( ) {
- for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
- echo " "
-}
-APP_ARGS=$(save "$@")
+# Collect all arguments for the java command, stacking in reverse order:
+# * args from the command line
+# * the main class name
+# * -classpath
+# * -D...appname settings
+# * --module-path (only if needed)
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
-# Collect all arguments for the java command, following the shell quoting and substitution rules
-eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if "$cygwin" || "$msys" ; then
+ APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
+ CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
-# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
-if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
- cd "$(dirname "$0")"
+ JAVACMD=$( cygpath --unix "$JAVACMD" )
+
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ for arg do
+ if
+ case $arg in #(
+ -*) false ;; # don't mess with options #(
+ /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
+ [ -e "$t" ] ;; #(
+ *) false ;;
+ esac
+ then
+ arg=$( cygpath --path --ignore --mixed "$arg" )
+ fi
+ # Roll the args list around exactly as many times as the number of
+ # args, so each arg winds up back in the position where it started, but
+ # possibly modified.
+ #
+ # NB: a `for` loop captures its iteration list before it begins, so
+ # changing the positional parameters here affects neither the number of
+ # iterations, nor the values presented in `arg`.
+ shift # remove old arg
+ set -- "$@" "$arg" # push replacement arg
+ done
fi
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Collect all arguments for the java command:
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
+# and any embedded shellness will be escaped.
+# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
+# treated as '${Hostname}' itself on the command line.
+
+set -- \
+ "-Dorg.gradle.appname=$APP_BASE_NAME" \
+ -classpath "$CLASSPATH" \
+ org.gradle.wrapper.GradleWrapperMain \
+ "$@"
+
+# Stop when "xargs" is not available.
+if ! command -v xargs >/dev/null 2>&1
+then
+ die "xargs is not available"
+fi
+
+# Use "xargs" to parse quoted args.
+#
+# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
+#
+# In Bash we could simply go:
+#
+# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
+# set -- "${ARGS[@]}" "$@"
+#
+# but POSIX shell has neither arrays nor command substitution, so instead we
+# post-process each arg (as a line of input to sed) to backslash-escape any
+# character that might be a shell metacharacter, then use eval to reverse
+# that process (while maintaining the separation between arguments), and wrap
+# the whole thing up as a single "set" statement.
+#
+# This will of course break if any of these variables contains a newline or
+# an unmatched quote.
+#
+
+eval "set -- $(
+ printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
+ xargs -n1 |
+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
+ tr '\n' ' '
+ )" '"$@"'
+
exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
old mode 100644
new mode 100755
index f955316..25da30d
--- a/gradlew.bat
+++ b/gradlew.bat
@@ -1,4 +1,20 @@
-@if "%DEBUG%" == "" @echo off
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
+@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@@ -9,25 +25,29 @@
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
+if "%DIRNAME%"=="" set DIRNAME=.
+@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
@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 DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@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
+if %ERRORLEVEL% equ 0 goto execute
-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.
+echo. 1>&2
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
+echo. 1>&2
+echo Please set the JAVA_HOME variable in your environment to match the 1>&2
+echo location of your Java installation. 1>&2
goto fail
@@ -35,48 +55,36 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-if exist "%JAVA_EXE%" goto init
+if exist "%JAVA_EXE%" goto execute
-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.
+echo. 1>&2
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
+echo. 1>&2
+echo Please set the JAVA_HOME variable in your environment to match the 1>&2
+echo location of your Java installation. 1>&2
goto fail
-:init
-@rem Get command-line arguments, handling Windows variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_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=%*
-
: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%
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
+if %ERRORLEVEL% equ 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
+set EXIT_CODE=%ERRORLEVEL%
+if %EXIT_CODE% equ 0 set EXIT_CODE=1
+if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
+exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
diff --git a/lwjgl3/build.gradle b/lwjgl3/build.gradle
new file mode 100644
index 0000000..2d65a2e
--- /dev/null
+++ b/lwjgl3/build.gradle
@@ -0,0 +1,110 @@
+buildscript {
+ repositories {
+ gradlePluginPortal()
+ }
+ dependencies {
+ if(enableGraalNative == 'true') {
+ classpath "org.graalvm.buildtools.native:org.graalvm.buildtools.native.gradle.plugin:0.9.28"
+ }
+ }
+}
+plugins {
+ id "io.github.fourlastor.construo" version "1.2.0"
+ id "application"
+}
+
+
+import io.github.fourlastor.construo.Target
+
+sourceSets.main.resources.srcDirs += [ rootProject.file('assets').path ]
+mainClassName = 'de.samdev.colorrunner.lwjgl3.Lwjgl3Launcher'
+application.setMainClass(mainClassName)
+eclipse.project.name = appName + '-lwjgl3'
+java.sourceCompatibility = 11
+java.targetCompatibility = 11
+
+dependencies {
+ implementation "com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion"
+ implementation "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop"
+ implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
+ implementation project(':core')
+}
+
+def jarName = "${appName}-${version}.jar"
+def os = System.properties['os.name'].toLowerCase()
+
+run {
+ workingDir = rootProject.file('assets').path
+ setIgnoreExitValue(true)
+
+ if (os.contains('mac')) jvmArgs += "-XstartOnFirstThread"
+}
+
+jar {
+// sets the name of the .jar file this produces to the name of the game or app.
+ archiveFileName.set(jarName)
+// using 'lib' instead of the default 'libs' appears to be needed by jpackageimage.
+ destinationDirectory = file("${project.layout.buildDirectory.asFile.get().absolutePath}/lib")
+// the duplicatesStrategy matters starting in Gradle 7.0; this setting works.
+ duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
+ dependsOn configurations.runtimeClasspath
+ from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
+// these "exclude" lines remove some unnecessary duplicate files in the output JAR.
+ exclude('META-INF/INDEX.LIST', 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA')
+ dependencies {
+ exclude('META-INF/INDEX.LIST', 'META-INF/maven/**')
+ }
+// setting the manifest makes the JAR runnable.
+ manifest {
+ attributes 'Main-Class': project.mainClassName
+ }
+// this last step may help on some OSes that need extra instruction to make runnable JARs.
+ doLast {
+ file(archiveFile).setExecutable(true, false)
+ }
+}
+
+construo {
+ // name of the executable
+ name.set(appName)
+ // human-readable name, used for example in the `.app` name for macOS
+ humanName.set(appName)
+ // Optional, defaults to project version
+ version.set("0.0.0")
+
+ targets.configure {
+ create("linuxX64", Target.Linux) {
+ architecture.set(Target.Architecture.X86_64)
+ jdkUrl.set("https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.11%2B9/OpenJDK17U-jdk_x64_linux_hotspot_17.0.11_9.tar.gz")
+ }
+ create("macM1", Target.MacOs) {
+ architecture.set(Target.Architecture.AARCH64)
+ jdkUrl.set("https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.11%2B9/OpenJDK17U-jdk_aarch64_mac_hotspot_17.0.11_9.tar.gz")
+ // macOS needs an identifier
+ identifier.set("i.should.be.changed.before.merge." + appName)
+ // Optional: icon for macOS
+ macIcon.set(project.file("icons/logo.icns"))
+ }
+ create("macX64", Target.MacOs) {
+ architecture.set(Target.Architecture.X86_64)
+ jdkUrl.set("https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.11%2B9/OpenJDK17U-jdk_x64_mac_hotspot_17.0.11_9.tar.gz")
+ // macOS needs an identifier
+ identifier.set("i.should.be.changed.before.merge." + appName)
+ // Optional: icon for macOS
+ macIcon.set(project.file("icons/logo.icns"))
+ }
+ create("winX64", Target.Windows) {
+ architecture.set(Target.Architecture.X86_64)
+ jdkUrl.set("https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.11%2B9/OpenJDK17U-jdk_x64_windows_hotspot_17.0.11_9.zip")
+ }
+ }
+}
+
+// Equivalent to the jar task; here for compatibility with gdx-setup.
+tasks.register('dist') {
+ dependsOn 'jar'
+}
+
+if(enableGraalNative == 'true') {
+ apply from: file("nativeimage.gradle")
+}
diff --git a/lwjgl3/icons/logo.icns b/lwjgl3/icons/logo.icns
new file mode 100644
index 0000000..5e41ad7
Binary files /dev/null and b/lwjgl3/icons/logo.icns differ
diff --git a/lwjgl3/icons/logo.ico b/lwjgl3/icons/logo.ico
new file mode 100644
index 0000000..c4f2d5e
Binary files /dev/null and b/lwjgl3/icons/logo.ico differ
diff --git a/lwjgl3/icons/logo.png b/lwjgl3/icons/logo.png
new file mode 100644
index 0000000..788f542
Binary files /dev/null and b/lwjgl3/icons/logo.png differ
diff --git a/lwjgl3/nativeimage.gradle b/lwjgl3/nativeimage.gradle
new file mode 100644
index 0000000..1489630
--- /dev/null
+++ b/lwjgl3/nativeimage.gradle
@@ -0,0 +1,63 @@
+
+project(":lwjgl3") {
+ apply plugin: "org.graalvm.buildtools.native"
+
+ dependencies {
+ implementation "io.github.berstanio:gdx-svmhelper-backend-lwjgl3:$graalHelperVersion"
+ implementation "io.github.berstanio:gdx-svmhelper-extension-box2d:$graalHelperVersion"
+ }
+ graalvmNative {
+ binaries {
+ main {
+ imageName = appName
+ mainClass = project.mainClassName
+ requiredVersion = '23.0'
+ buildArgs.add("-march=compatibility")
+ jvmArgs.addAll("-Dfile.encoding=UTF8")
+ sharedLibrary = false
+ }
+ }
+ }
+
+ run {
+ doNotTrackState("Running the app should not be affected by Graal.")
+ }
+
+ // Modified from https://lyze.dev/2021/04/29/libGDX-Internal-Assets-List/ ; thanks again, Lyze!
+ // This creates a resource-config.json file based on the contents of the assets folder (and the libGDX icons).
+ // This file is used by Graal Native to embed those specific files.
+ // This has to run before nativeCompile, so it runs at the start of an unrelated resource-handling command.
+ generateResourcesConfigFile.doFirst {
+ def assetsFolder = new File("${project.rootDir}/assets/")
+ def lwjgl3 = project(':lwjgl3')
+ def resFolder = new File("${lwjgl3.projectDir}/src/main/resources/META-INF/native-image/${lwjgl3.ext.appName}")
+ resFolder.mkdirs()
+ def resFile = new File(resFolder, "resource-config.json")
+ resFile.delete()
+ resFile.append(
+ """{
+ "resources":{
+ "includes":[
+ {
+ "pattern": ".*(""")
+ // This adds every filename in the assets/ folder to a pattern that adds those files as resources.
+ fileTree(assetsFolder).each {
+ // The backslash-Q and backslash-E escape the start and end of a literal string, respectively.
+ resFile.append("\\\\Q${it.name}\\\\E|")
+ }
+ // We also match all of the window icon images this way and the font files that are part of libGDX.
+ resFile.append(
+ """libgdx.+\\\\.png|lsans.+)"
+ }
+ ]},
+ "bundles":[]
+}"""
+ )
+ }
+}
+
+project(":core") {
+ dependencies {
+ implementation "io.github.berstanio:gdx-svmhelper-annotations:$graalHelperVersion"
+ }
+}
diff --git a/lwjgl3/src/main/java/de/samdev/colorrunner/lwjgl3/Lwjgl3Launcher.java b/lwjgl3/src/main/java/de/samdev/colorrunner/lwjgl3/Lwjgl3Launcher.java
new file mode 100644
index 0000000..20819ed
--- /dev/null
+++ b/lwjgl3/src/main/java/de/samdev/colorrunner/lwjgl3/Lwjgl3Launcher.java
@@ -0,0 +1,31 @@
+package de.samdev.colorrunner.lwjgl3;
+
+import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application;
+import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration;
+import de.samdev.colorrunner.CRGame;
+
+/** Launches the desktop (LWJGL3) application. */
+public class Lwjgl3Launcher {
+ public static void main(String[] args) {
+ if (StartupHelper.startNewJvmIfRequired()) return; // This handles macOS support and helps on Windows.
+ createApplication();
+ }
+
+ private static Lwjgl3Application createApplication() {
+ return new Lwjgl3Application(new CRGame(), getDefaultConfiguration());
+ }
+
+ private static Lwjgl3ApplicationConfiguration getDefaultConfiguration() {
+ Lwjgl3ApplicationConfiguration configuration = new Lwjgl3ApplicationConfiguration();
+ configuration.setTitle("ColorRunner");
+ configuration.useVsync(true);
+ //// Limits FPS to the refresh rate of the currently active monitor.
+ configuration.setForegroundFPS(Lwjgl3ApplicationConfiguration.getDisplayMode().refreshRate);
+ //// If you remove the above line and set Vsync to false, you can get unlimited FPS, which can be
+ //// useful for testing performance, but can also be very stressful to some hardware.
+ //// You may also need to configure GPU drivers to fully disable Vsync; this can cause screen tearing.
+ configuration.setWindowedMode(640, 480);
+ configuration.setWindowIcon("libgdx128.png", "libgdx64.png", "libgdx32.png", "libgdx16.png");
+ return configuration;
+ }
+}
\ No newline at end of file
diff --git a/lwjgl3/src/main/java/de/samdev/colorrunner/lwjgl3/StartupHelper.java b/lwjgl3/src/main/java/de/samdev/colorrunner/lwjgl3/StartupHelper.java
new file mode 100644
index 0000000..016b8fc
--- /dev/null
+++ b/lwjgl3/src/main/java/de/samdev/colorrunner/lwjgl3/StartupHelper.java
@@ -0,0 +1,179 @@
+/*
+ * Copyright 2020 damios
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+//Note, the above license and copyright applies to this file only.
+
+package de.samdev.colorrunner.lwjgl3;
+
+import org.lwjgl.system.macosx.LibC;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.InputStreamReader;
+import java.lang.management.ManagementFactory;
+import java.util.ArrayList;
+
+/**
+ * Adds some utilities to ensure that the JVM was started with the
+ * {@code -XstartOnFirstThread} argument, which is required on macOS for LWJGL 3
+ * to function. Also helps on Windows when users have names with characters from
+ * outside the Latin alphabet, a common cause of startup crashes.
+ *
+ * Based on this java-gaming.org post by kappa
+ * @author damios
+ */
+public class StartupHelper {
+
+ private static final String JVM_RESTARTED_ARG = "jvmIsRestarted";
+
+ private StartupHelper() {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Starts a new JVM if the application was started on macOS without the
+ * {@code -XstartOnFirstThread} argument. This also includes some code for
+ * Windows, for the case where the user's home directory includes certain
+ * non-Latin-alphabet characters (without this code, most LWJGL3 apps fail
+ * immediately for those users). Returns whether a new JVM was started and
+ * thus no code should be executed.
+ *
+ * Usage:
+ *
+ *
+ * public static void main(String... args) {
+ * if (StartupHelper.startNewJvmIfRequired(true)) return; // This handles macOS support and helps on Windows.
+ * // after this is the actual main method code
+ * }
+ *
+ *
+ * @param redirectOutput
+ * whether the output of the new JVM should be rerouted to the
+ * old JVM, so it can be accessed in the same place; keeps the
+ * old JVM running if enabled
+ * @return whether a new JVM was started and thus no code should be executed
+ * in this one
+ */
+ public static boolean startNewJvmIfRequired(boolean redirectOutput) {
+ String osName = System.getProperty("os.name").toLowerCase();
+ if (!osName.contains("mac")) {
+ if (osName.contains("windows")) {
+// Here, we are trying to work around an issue with how LWJGL3 loads its extracted .dll files.
+// By default, LWJGL3 extracts to the directory specified by "java.io.tmpdir", which is usually the user's home.
+// If the user's name has non-ASCII (or some non-alphanumeric) characters in it, that would fail.
+// By extracting to the relevant "ProgramData" folder, which is usually "C:\ProgramData", we avoid this.
+ System.setProperty("java.io.tmpdir", System.getenv("ProgramData") + "/libGDX-temp");
+ }
+ return false;
+ }
+
+ // There is no need for -XstartOnFirstThread on Graal native image
+ if (!System.getProperty("org.graalvm.nativeimage.imagecode", "").isEmpty()) {
+ return false;
+ }
+
+ long pid = LibC.getpid();
+
+ // check whether -XstartOnFirstThread is enabled
+ if ("1".equals(System.getenv("JAVA_STARTED_ON_FIRST_THREAD_" + pid))) {
+ return false;
+ }
+
+ // check whether the JVM was previously restarted
+ // avoids looping, but most certainly leads to a crash
+ if ("true".equals(System.getProperty(JVM_RESTARTED_ARG))) {
+ System.err.println(
+ "There was a problem evaluating whether the JVM was started with the -XstartOnFirstThread argument.");
+ return false;
+ }
+
+ // Restart the JVM with -XstartOnFirstThread
+ ArrayList jvmArgs = new ArrayList<>();
+ String separator = System.getProperty("file.separator");
+ // The following line is used assuming you target Java 8, the minimum for LWJGL3.
+ String javaExecPath = System.getProperty("java.home") + separator + "bin" + separator + "java";
+ // If targeting Java 9 or higher, you could use the following instead of the above line:
+ //String javaExecPath = ProcessHandle.current().info().command().orElseThrow();
+
+ if (!(new File(javaExecPath)).exists()) {
+ System.err.println(
+ "A Java installation could not be found. If you are distributing this app with a bundled JRE, be sure to set the -XstartOnFirstThread argument manually!");
+ return false;
+ }
+
+ jvmArgs.add(javaExecPath);
+ jvmArgs.add("-XstartOnFirstThread");
+ jvmArgs.add("-D" + JVM_RESTARTED_ARG + "=true");
+ jvmArgs.addAll(ManagementFactory.getRuntimeMXBean().getInputArguments());
+ jvmArgs.add("-cp");
+ jvmArgs.add(System.getProperty("java.class.path"));
+ String mainClass = System.getenv("JAVA_MAIN_CLASS_" + pid);
+ if (mainClass == null) {
+ StackTraceElement[] trace = Thread.currentThread().getStackTrace();
+ if (trace.length > 0) {
+ mainClass = trace[trace.length - 1].getClassName();
+ } else {
+ System.err.println("The main class could not be determined.");
+ return false;
+ }
+ }
+ jvmArgs.add(mainClass);
+
+ try {
+ if (!redirectOutput) {
+ ProcessBuilder processBuilder = new ProcessBuilder(jvmArgs);
+ processBuilder.start();
+ } else {
+ Process process = (new ProcessBuilder(jvmArgs))
+ .redirectErrorStream(true).start();
+ BufferedReader processOutput = new BufferedReader(
+ new InputStreamReader(process.getInputStream()));
+ String line;
+
+ while ((line = processOutput.readLine()) != null) {
+ System.out.println(line);
+ }
+
+ process.waitFor();
+ }
+ } catch (Exception e) {
+ System.err.println("There was a problem restarting the JVM");
+ e.printStackTrace();
+ }
+
+ return true;
+ }
+
+ /**
+ * Starts a new JVM if the application was started on macOS without the
+ * {@code -XstartOnFirstThread} argument. Returns whether a new JVM was
+ * started and thus no code should be executed. Redirects the output of the
+ * new JVM to the old one.
+ *
+ * Usage:
+ *
+ *
+ * public static void main(String... args) {
+ * if (StartupHelper.startNewJvmIfRequired()) return; // This handles macOS support and helps on Windows.
+ * // the actual main method code
+ * }
+ *
+ *
+ * @return whether a new JVM was started and thus no code should be executed
+ * in this one
+ */
+ public static boolean startNewJvmIfRequired() {
+ return startNewJvmIfRequired(true);
+ }
+}
\ No newline at end of file
diff --git a/lwjgl3/src/main/resources/libgdx128.png b/lwjgl3/src/main/resources/libgdx128.png
new file mode 100644
index 0000000..788f542
Binary files /dev/null and b/lwjgl3/src/main/resources/libgdx128.png differ
diff --git a/lwjgl3/src/main/resources/libgdx16.png b/lwjgl3/src/main/resources/libgdx16.png
new file mode 100644
index 0000000..47af189
Binary files /dev/null and b/lwjgl3/src/main/resources/libgdx16.png differ
diff --git a/lwjgl3/src/main/resources/libgdx32.png b/lwjgl3/src/main/resources/libgdx32.png
new file mode 100644
index 0000000..4cf903a
Binary files /dev/null and b/lwjgl3/src/main/resources/libgdx32.png differ
diff --git a/lwjgl3/src/main/resources/libgdx64.png b/lwjgl3/src/main/resources/libgdx64.png
new file mode 100644
index 0000000..ebcd8f1
Binary files /dev/null and b/lwjgl3/src/main/resources/libgdx64.png differ
diff --git a/settings.gradle b/settings.gradle
index 77ae463..7f8a8d9 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1 +1,4 @@
-include 'desktop', 'android', 'core'
\ No newline at end of file
+// A list of which subprojects to load as part of the same larger project.
+// You can remove Strings from the list and reload the Gradle project
+// if you want to temporarily disable a subproject.
+include 'lwjgl3', 'core', 'android'