diff --git a/android/.gitignore b/android/.gitignore
new file mode 100644
index 0000000..42afabf
--- /dev/null
+++ b/android/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/android/build.gradle b/android/build.gradle
new file mode 100644
index 0000000..b9ea611
--- /dev/null
+++ b/android/build.gradle
@@ -0,0 +1,57 @@
+buildscript {
+ repositories {
+ jcenter()
+ google()
+ }
+
+ dependencies {
+ classpath 'com.android.tools.build:gradle:4.1.1'
+ }
+}
+
+apply plugin: 'com.android.application'
+
+repositories {
+ jcenter()
+ google()
+}
+
+android {
+ compileSdkVersion 29
+ buildToolsVersion "30.0.2"
+
+ defaultConfig {
+ applicationId "markil3.controller"
+ minSdkVersion 19
+ targetSdkVersion 29
+ versionCode 1
+ versionName "1.0"
+
+ testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+}
+
+dependencies {
+ api(project(":desktop")) {
+ exclude module: "jme3-lwjgl3"
+ exclude module: "jme3-desktop"
+ exclude module: "slf4j-simple"
+ }
+ implementation "uk.uuid.slf4j:slf4j-android:1.7.30-0"
+ implementation "${jme3.g}:jme3-android:${jme3.version}"
+ implementation "${jme3.g}:jme3-android-native:${jme3.version}"
+ implementation "androidx.appcompat:appcompat:1.1.0"
+ implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
+ coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:1.0.9"
+}
diff --git a/android/proguard-rules.pro b/android/proguard-rules.pro
new file mode 100644
index 0000000..481bb43
--- /dev/null
+++ b/android/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# 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 *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
\ No newline at end of file
diff --git a/android/src/androidTest/java/markil3/controller/ExampleInstrumentedTest.java b/android/src/androidTest/java/markil3/controller/ExampleInstrumentedTest.java
new file mode 100644
index 0000000..72222b9
--- /dev/null
+++ b/android/src/androidTest/java/markil3/controller/ExampleInstrumentedTest.java
@@ -0,0 +1,28 @@
+package markil3.controller;
+
+import android.content.Context;
+import android.support.test.InstrumentationRegistry;
+import android.support.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static org.junit.Assert.*;
+
+/**
+ * Instrumented test, which will execute on an Android device.
+ *
+ * @see Testing documentation
+ */
+@RunWith(AndroidJUnit4.class)
+public class ExampleInstrumentedTest
+{
+ @Test
+ public void useAppContext()
+ {
+ // Context of the app under test.
+ Context appContext =
+ InstrumentationRegistry.getInstrumentation().getTargetContext();
+ assertEquals("markil3.jmecontrollerconfig", appContext.getPackageName());
+ }
+}
\ No newline at end of file
diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..fc60c04
--- /dev/null
+++ b/android/src/main/AndroidManifest.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/android/src/main/java/markil3/controller/MainActivity.java b/android/src/main/java/markil3/controller/MainActivity.java
new file mode 100644
index 0000000..1876357
--- /dev/null
+++ b/android/src/main/java/markil3/controller/MainActivity.java
@@ -0,0 +1,73 @@
+package markil3.controller;
+
+import android.content.res.Configuration;
+import android.os.Bundle;
+
+import com.jme3.app.AndroidHarness;
+import com.jme3.system.AppSettings;
+
+import java.util.logging.Level;
+import java.util.logging.LogManager;
+
+public class MainActivity extends AndroidHarness
+{
+ /*
+ * Note that you can ignore the errors displayed in this file, the android
+ * project will build regardless. Install the 'Android' plugin under
+ * Tools->Plugins->Available Plugins to get error checks and code completion
+ * for the Android project files.
+ */
+ public MainActivity()
+ {
+ /*
+ * Set the default logging level (default=Level.INFO, Level.ALL=All
+ * Debug Info)
+ */
+ LogManager.getLogManager().getLogger("").setLevel(Level.INFO);
+
+ this.appClass = Main.class.getName();
+
+ // Set the desired EGL configuration
+ eglBitsPerPixel = 24;
+ eglAlphaBits = 0;
+ eglDepthBits = 16;
+ eglSamples = 0;
+ eglStencilBits = 0;
+
+ // Set the maximum framerate
+ // (default = -1 for unlimited)
+ frameRate = -1;
+
+ // Set the maximum resolution dimension
+ // (the smaller side, height or width, is set automatically
+ // to maintain the original device screen aspect ratio)
+ // (default = -1 to match device screen resolution)
+// maxResolutionDimension = -1;
+
+ // Set input configuration settings
+ joystickEventsEnabled = true;
+ keyEventsEnabled = true;
+ mouseEventsEnabled = true;
+
+ // Set application exit settings
+ finishOnAppStop = true;
+ handleExitHook = false;
+ exitDialogTitle = "Do you want to exit?";
+ exitDialogMessage =
+ "Use your home key to bring this app into the background " +
+ "or exit to terminate it.";
+
+ // Set splash screen resource id, if used
+ // (default = 0, no splash screen)
+ // For example, if the image file name is "splash"...
+ // splashPicID = R.drawable.splash;
+ splashPicID = 0;
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState)
+ {
+ super.onCreate(savedInstanceState);
+ this.setImmersive(true);
+ }
+}
diff --git a/android/src/main/res/drawable-v24/ic_launcher_foreground.xml b/android/src/main/res/drawable-v24/ic_launcher_foreground.xml
new file mode 100644
index 0000000..2b068d1
--- /dev/null
+++ b/android/src/main/res/drawable-v24/ic_launcher_foreground.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/android/src/main/res/drawable/ic_launcher_background.xml b/android/src/main/res/drawable/ic_launcher_background.xml
new file mode 100644
index 0000000..07d5da9
--- /dev/null
+++ b/android/src/main/res/drawable/ic_launcher_background.xml
@@ -0,0 +1,170 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/android/src/main/res/layout/activity_main.xml b/android/src/main/res/layout/activity_main.xml
new file mode 100644
index 0000000..84f1951
--- /dev/null
+++ b/android/src/main/res/layout/activity_main.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/android/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/android/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
new file mode 100644
index 0000000..eca70cf
--- /dev/null
+++ b/android/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/android/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/android/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
new file mode 100644
index 0000000..eca70cf
--- /dev/null
+++ b/android/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/android/src/main/res/mipmap-hdpi/ic_launcher.png b/android/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 0000000..a571e60
Binary files /dev/null and b/android/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/android/src/main/res/mipmap-hdpi/ic_launcher_round.png b/android/src/main/res/mipmap-hdpi/ic_launcher_round.png
new file mode 100644
index 0000000..61da551
Binary files /dev/null and b/android/src/main/res/mipmap-hdpi/ic_launcher_round.png differ
diff --git a/android/src/main/res/mipmap-mdpi/ic_launcher.png b/android/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 0000000..c41dd28
Binary files /dev/null and b/android/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/android/src/main/res/mipmap-mdpi/ic_launcher_round.png b/android/src/main/res/mipmap-mdpi/ic_launcher_round.png
new file mode 100644
index 0000000..db5080a
Binary files /dev/null and b/android/src/main/res/mipmap-mdpi/ic_launcher_round.png differ
diff --git a/android/src/main/res/mipmap-xhdpi/ic_launcher.png b/android/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..6dba46d
Binary files /dev/null and b/android/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/android/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/android/src/main/res/mipmap-xhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..da31a87
Binary files /dev/null and b/android/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ
diff --git a/android/src/main/res/mipmap-xxhdpi/ic_launcher.png b/android/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..15ac681
Binary files /dev/null and b/android/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/android/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/android/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..b216f2d
Binary files /dev/null and b/android/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ
diff --git a/android/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/android/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 0000000..f25a419
Binary files /dev/null and b/android/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/android/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/android/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..e96783c
Binary files /dev/null and b/android/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ
diff --git a/android/src/main/res/values-night/themes.xml b/android/src/main/res/values-night/themes.xml
new file mode 100644
index 0000000..19a258d
--- /dev/null
+++ b/android/src/main/res/values-night/themes.xml
@@ -0,0 +1,10 @@
+
+
+
+
\ No newline at end of file
diff --git a/android/src/main/res/values/colors.xml b/android/src/main/res/values/colors.xml
new file mode 100644
index 0000000..f8c6127
--- /dev/null
+++ b/android/src/main/res/values/colors.xml
@@ -0,0 +1,10 @@
+
+
+ #FFBB86FC
+ #FF6200EE
+ #FF3700B3
+ #FF03DAC5
+ #FF018786
+ #FF000000
+ #FFFFFFFF
+
\ No newline at end of file
diff --git a/android/src/main/res/values/strings.xml b/android/src/main/res/values/strings.xml
new file mode 100644
index 0000000..1d6ffb7
--- /dev/null
+++ b/android/src/main/res/values/strings.xml
@@ -0,0 +1,3 @@
+
+ JMEControllerConfig
+
\ No newline at end of file
diff --git a/android/src/main/res/values/themes.xml b/android/src/main/res/values/themes.xml
new file mode 100644
index 0000000..f012357
--- /dev/null
+++ b/android/src/main/res/values/themes.xml
@@ -0,0 +1,10 @@
+
+
+
+
\ No newline at end of file
diff --git a/android/src/test/java/markil3/controller/ExampleUnitTest.java b/android/src/test/java/markil3/controller/ExampleUnitTest.java
new file mode 100644
index 0000000..1f98386
--- /dev/null
+++ b/android/src/test/java/markil3/controller/ExampleUnitTest.java
@@ -0,0 +1,19 @@
+package markil3.controller;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * Example local unit test, which will execute on the development machine (host).
+ *
+ * @see Testing documentation
+ */
+public class ExampleUnitTest
+{
+ @Test
+ public void addition_isCorrect()
+ {
+ assertEquals(4, 2 + 2);
+ }
+}
\ No newline at end of file
diff --git a/desktop/src/main/java/markil3/controller/Main.java b/desktop/src/main/java/markil3/controller/Main.java
index 84064b7..49a2ac2 100644
--- a/desktop/src/main/java/markil3/controller/Main.java
+++ b/desktop/src/main/java/markil3/controller/Main.java
@@ -160,16 +160,36 @@ public class Main extends SimpleApplication implements ActionListener
@Override
public void initialize()
{
+ final File[] possibleGameDirs =
+ new File[]{new File(System.getProperty("user.dir")),
+ new File(System.getProperty("user.home")),
+ JmeSystem.getStorageFolder(
+ JmeSystem.StorageFolderType.External)};
+ int i, l;
if (GAME_FOLDER == null)
{
- GAME_FOLDER = new File(System.getProperty("user.dir"));
- if (!GAME_FOLDER.isDirectory())
+ for (i = 0, l = possibleGameDirs.length; i < l; i++)
{
- if (!GAME_FOLDER.mkdir())
+ GAME_FOLDER = possibleGameDirs[i];
+ if (!GAME_FOLDER.isDirectory())
{
- throw new RuntimeException(
- "Could not create game directory folder.");
+ if (!GAME_FOLDER.mkdir())
+ {
+ logger.warn("Cannot make " + GAME_FOLDER);
+ continue;
+ }
}
+ if (!GAME_FOLDER.canWrite())
+ {
+ logger.warn("Cannot write to " + GAME_FOLDER);
+ continue;
+ }
+ break;
+ }
+ if (i == l)
+ {
+ throw new RuntimeException(
+ "Could not create game directory folder.");
}
}
/*
@@ -184,19 +204,23 @@ public class Main extends SimpleApplication implements ActionListener
{
this.calibrateButton =
GUIUtils.createButton(this.getAssetManager(), this.guiFont,
- "calibrate", "Calibrate Gamepad");
- this.calibrateButton.setLocalTranslation((this.getCamera().getWidth() -
- ((BitmapText) this.calibrateButton.getChild(1)).getLineWidth() -
- 10) / 2F, this.getCamera().getHeight(), 0);
+ this.getContext().getTouchInput() != null, "calibrate",
+ "Calibrate Gamepad");
}
@Override
public void simpleUpdate(float tpf)
{
- JoystickPreviewScreen screen = this.getStateManager().getState(JoystickPreviewScreen.class);
+ JoystickPreviewScreen screen =
+ this.getStateManager().getState(JoystickPreviewScreen.class);
if (this.calibrateButton.getParent() == null && screen != null)
{
this.guiNode.attachChild(this.calibrateButton);
+ this.calibrateButton.setLocalTranslation(
+ (this.getCamera().getWidth() -
+ ((BitmapText) this.calibrateButton.getChild(1))
+ .getLineWidth() - 10) / 2F,
+ this.getCamera().getHeight(), 0);
this.inputManager.addListener(this, screen.CLICK_MAPPING);
}
else if (this.calibrateButton.getParent() != null && screen == null)
@@ -210,17 +234,43 @@ public class Main extends SimpleApplication implements ActionListener
public void onAction(String name, boolean isPressed, float tpf)
{
String buttonId;
- JoystickPreviewScreen screen = this.getStateManager().getState(JoystickPreviewScreen.class);
+ JoystickPreviewScreen screen =
+ this.getStateManager().getState(JoystickPreviewScreen.class);
if (screen != null && name.equals(screen.CLICK_MAPPING))
{
buttonId = GUIUtils.handleButtonPress(this.calibrateButton,
- this.getInputManager().getCursorPosition(),
- isPressed);
+ this.getInputManager().getCursorPosition(), isPressed);
if (!isPressed && "calibrate".equals(buttonId))
{
this.getStateManager().detach(screen);
- this.getStateManager().attach(new CalibrateInputScreen(CALIBRATION_FILE));
+ this.getStateManager()
+ .attach(new CalibrateInputScreen(CALIBRATION_FILE));
}
}
}
+
+ @Override
+ public void restart()
+ {
+ super.restart();
+ this.enqueue(() -> {
+ JoystickPreviewScreen previewScreen = this.getStateManager()
+ .getState(JoystickPreviewScreen.class);
+ CalibrateInputScreen calibrateScreen =
+ this.getStateManager().getState(CalibrateInputScreen.class);
+ if (previewScreen != null)
+ {
+ previewScreen.resize();
+ }
+ if (calibrateScreen != null)
+ {
+ calibrateScreen.resize();
+ }
+ this.calibrateButton.setLocalTranslation(
+ (this.getCamera().getWidth() -
+ ((BitmapText) this.calibrateButton.getChild(1))
+ .getLineWidth() - 10) / 2F,
+ this.getCamera().getHeight(), 0);
+ });
+ }
}
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 0000000..fb336dc
--- /dev/null
+++ b/gradle.properties
@@ -0,0 +1,15 @@
+## For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+#
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+# Default value: -Xmx1024m -XX:MaxPermSize=256m
+# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
+#
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true
+#Fri Dec 18 13:35:19 MST 2020
+android.enableJetifier=true
+android.useAndroidX=true
diff --git a/library/src/main/java/markil3/controller/CalibrateInputScreen.java b/library/src/main/java/markil3/controller/CalibrateInputScreen.java
index aab007c..016a9c1 100644
--- a/library/src/main/java/markil3/controller/CalibrateInputScreen.java
+++ b/library/src/main/java/markil3/controller/CalibrateInputScreen.java
@@ -181,7 +181,7 @@ public class CalibrateInputScreen extends BaseAppState
this.introCont.attachChild(text);
this.startButton =
- GUIUtils.createButton(app.getAssetManager(), this.guiFont,
+ GUIUtils.createButton(app.getAssetManager(), this.guiFont, app.getContext().getTouchInput() != null,
"start", "Start");
// this.startButton.addClickCommands(this);
this.introCont.attachChild(this.startButton);
@@ -193,16 +193,16 @@ public class CalibrateInputScreen extends BaseAppState
"on the controller you want to calibrate."));
this.skipButton =
- GUIUtils.createButton(app.getAssetManager(), this.guiFont,
+ GUIUtils.createButton(app.getAssetManager(), this.guiFont, app.getContext().getTouchInput() != null,
"skip", "Skip");
this.cancelButton =
- GUIUtils.createButton(app.getAssetManager(), this.guiFont,
+ GUIUtils.createButton(app.getAssetManager(), this.guiFont, app.getContext().getTouchInput() != null,
"cancel", "Cancel");
this.introCont.attachChild(this.cancelButton);
this.restartButton =
- GUIUtils.createButton(app.getAssetManager(), this.guiFont,
+ GUIUtils.createButton(app.getAssetManager(), this.guiFont, app.getContext().getTouchInput() != null,
"close", "Close Application");
this.gui.attachChild(this.introCont);
diff --git a/library/src/main/java/markil3/controller/GUIUtils.java b/library/src/main/java/markil3/controller/GUIUtils.java
index 005bc26..1e7b21f 100644
--- a/library/src/main/java/markil3/controller/GUIUtils.java
+++ b/library/src/main/java/markil3/controller/GUIUtils.java
@@ -42,18 +42,24 @@ public class GUIUtils
* to trigger events.
* @param assets - The application asset manager.
* @param guiFont - The font to use for the button.
+ * @param isMobile - Whether or not the mobile size increase should be used.
* @param id - The button ID. This is used to identify which button was
* pressed later on.
* @param content - The text that will display in the button.
* @return A node containing the button elements.
*/
public static Node createButton(AssetManager assets, BitmapFont guiFont,
- String id, String content)
+ boolean isMobile, String id, String content)
{
+ final float MOBILE_SIZE = 30F;
BitmapText buttonText;
Geometry buttonBackground;
Node button = new Node();
buttonText = guiFont.createLabel(content);
+ if (isMobile)
+ {
+ buttonText.setSize(MOBILE_SIZE);
+ }
buttonText.setUserData(BUTTON_ID, id);
buttonText.setBox(new Rectangle(0, 0, buttonText.getLineWidth(),
buttonText.getLineHeight()));
@@ -78,7 +84,7 @@ public class GUIUtils
/**
* Call this method from a mouse listener to search the provided node for
* any buttons created with
- * {@link #createButton(AssetManager, BitmapFont, String, String)} and
+ * {@link #createButton(AssetManager, BitmapFont, boolean, String, String)} and
* returns their ID.
* @param gui - The GUI to search.
* @param cursor - The position of the mouse cursor.
@@ -112,7 +118,7 @@ public class GUIUtils
results = new CollisionResults();
ray = new Ray(new Vector3f(cursor.x, cursor.y, 0),
- new Vector3f(cursor.x, cursor.y, 1));
+ new Vector3f(0, 0, 1));
gui.collideWith(ray, results);
for (CollisionResult result : results)
{
@@ -190,9 +196,9 @@ public class GUIUtils
{
Quad quad = ((Quad) ((Geometry) ((Node) node).getChild(0))
.getMesh());
- node.setLocalTranslation(-quad.getWidth() / 2F,
- -totalHeight - 10, 0);
- totalHeight += quad.getHeight() + 10;
+ node.setLocalTranslation(-quad.getWidth() / 2F,
+ -totalHeight - 10, 0);
+ totalHeight += quad.getHeight() + 10;
}
}
return totalHeight;
diff --git a/library/src/main/java/markil3/controller/JoystickPreviewScreen.java b/library/src/main/java/markil3/controller/JoystickPreviewScreen.java
index 69c17c2..028a050 100644
--- a/library/src/main/java/markil3/controller/JoystickPreviewScreen.java
+++ b/library/src/main/java/markil3/controller/JoystickPreviewScreen.java
@@ -689,6 +689,7 @@ public class JoystickPreviewScreen extends BaseAppState
{
this.gamepadHeaders[i] = GUIUtils.createButton(
this.getApplication().getAssetManager(), this.guiFont,
+ this.getApplication().getContext().getTouchInput() != null,
"gamepad" + i, "Gamepad " +
this.getApplication().getInputManager()
.getJoysticks()[i].getJoyId());
@@ -741,6 +742,7 @@ public class JoystickPreviewScreen extends BaseAppState
*/
private void setLabels(Joystick joy)
{
+ int offset = this.getApplication().getContext().getTouchInput() != null ? 10: 0;
/*
* Removes the old labels.
*/
@@ -761,9 +763,11 @@ public class JoystickPreviewScreen extends BaseAppState
/*
* The name of the gamepad.
*/
- this.labels[joy.getJoyId()][0] = this.guiFont.createLabel(
- "Gamepad " + joy.getJoyId() + ": " + joy.getName());
- this.labels[joy.getJoyId()][0].setLocalTranslation(20, -25, 0);
+// this.labels[joy.getJoyId()][0] = this.guiFont.createLabel(
+// "Gamepad " + joy.getJoyId() + ": " + joy.getName());
+ this.labels[joy.getJoyId()][0] =
+ this.guiFont.createLabel(joy.getName());
+ this.labels[joy.getJoyId()][0].setLocalTranslation(20, -25 - offset, 0);
this.gamepadCont[joy.getJoyId()]
.attachChild(this.labels[joy.getJoyId()][0]);
/*
@@ -771,11 +775,12 @@ public class JoystickPreviewScreen extends BaseAppState
* index of the axis, its given name, its logical ID after
* joystick remapping has occurred, and the axis index again.
* TODO - Whenever I add the " Gamepad X: " part to the previous
- * label, this one displays all funky.
+ * label, this one displays all funky. Also, the lag gets really
+ * bad.
*/
this.labels[joy.getJoyId()][1] = this.guiFont
.createLabel("Axis Index: Axis Name (logical ID, axis ID)");
- this.labels[joy.getJoyId()][1].setLocalTranslation(20, -50, 0);
+ this.labels[joy.getJoyId()][1].setLocalTranslation(20, -50 - offset, 0);
this.gamepadCont[joy.getJoyId()]
.attachChild(this.labels[joy.getJoyId()][1]);
/*
@@ -793,7 +798,7 @@ public class JoystickPreviewScreen extends BaseAppState
(i) + ": " + axis.getName() + " (" +
axis.getLogicalId() + ", " +
axis.getAxisId() + "): ");
- label.setLocalTranslation(20, -25 * (i + 3), 0);
+ label.setLocalTranslation(20, -25 * (i + 3) - offset, 0);
this.labels[joy.getJoyId()][i * 2 + 1] = label;
/*
@@ -835,7 +840,7 @@ public class JoystickPreviewScreen extends BaseAppState
this.labels[joy.getJoyId()][firstButtonIndex].setLocalTranslation(
this.getScreenSize().x -
this.labels[joy.getJoyId()][firstButtonIndex]
- .getLineWidth(), -50, 0);
+ .getLineWidth(), -50 - offset, 0);
this.gamepadCont[joy.getJoyId()]
.attachChild(this.labels[joy.getJoyId()][firstButtonIndex]);
@@ -855,7 +860,7 @@ public class JoystickPreviewScreen extends BaseAppState
BitmapText label2 = this.guiFont.createLabel("false");
label2.setLocalTranslation(
this.getScreenSize().x - label2.getLineWidth(),
- -25 * (i + 3), 0);
+ -25 * (i + 3) - offset, 0);
/*
* The name and information for the button.
@@ -914,7 +919,7 @@ public class JoystickPreviewScreen extends BaseAppState
for (int i = 0, l = this.gamepadHeaders.length; i < l; i++)
{
button = this.gamepadHeaders[i];
- button.setLocalTranslation(128 * i, 0, 0);
+ button.setLocalTranslation((this.getApplication().getContext().getTouchInput() != null ? 192 : 128) * i, 0, 0);
}
}
if (this.gamepadView != null)
diff --git a/settings.gradle b/settings.gradle
index 2c6ba7e..a6d5cff 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -7,6 +7,7 @@
* Detailed information about configuring a multi-project build in Gradle can be found
* in the user guide at https://docs.gradle.org/4.4.1/userguide/multi_project_builds.html
*/
+include ':jmecontrollerconfig'
/*
// To declare projects as part of a multi-project build use the 'include' method
@@ -18,4 +19,5 @@ include 'services:webservice'
rootProject.name = 'JMEControllerConfig'
include "library"
include "desktop"
-include "desktopLegacy"
\ No newline at end of file
+include "desktopLegacy"
+include "android"
\ No newline at end of file