diff --git a/SPD-classes/build.gradle b/SPD-classes/build.gradle index 71066fc52..430d874e2 100644 --- a/SPD-classes/build.gradle +++ b/SPD-classes/build.gradle @@ -7,7 +7,6 @@ dependencies { //TODO migrate this to implementation from api //in order to do this I have to remove 100% of libGDX API access from core api "com.badlogicgames.gdx:gdx:$gdxVersion" - implementation "com.badlogicgames.gdx:gdx-controllers:$gdxVersion" implementation "com.badlogicgames.gdx:gdx-freetype:$gdxVersion" //noinspection GradleDependency , later JSON versions cause crashes on old versions of android diff --git a/SPD-classes/src/main/java/com/watabou/input/InputHandler.java b/SPD-classes/src/main/java/com/watabou/input/InputHandler.java index 399dbf9de..ab62a4188 100644 --- a/SPD-classes/src/main/java/com/watabou/input/InputHandler.java +++ b/SPD-classes/src/main/java/com/watabou/input/InputHandler.java @@ -109,8 +109,8 @@ public class InputHandler extends InputAdapter { // ******************** @Override - public boolean scrolled(int amount) { - ScrollEvent.addScrollEvent( new ScrollEvent(pointerHoverPos, amount)); + public boolean scrolled(float amountX, float amountY) { + ScrollEvent.addScrollEvent( new ScrollEvent(pointerHoverPos, amountY)); return true; } } diff --git a/SPD-classes/src/main/java/com/watabou/input/ScrollEvent.java b/SPD-classes/src/main/java/com/watabou/input/ScrollEvent.java index 917968993..3316b3c23 100644 --- a/SPD-classes/src/main/java/com/watabou/input/ScrollEvent.java +++ b/SPD-classes/src/main/java/com/watabou/input/ScrollEvent.java @@ -29,9 +29,9 @@ import java.util.ArrayList; public class ScrollEvent { public PointF pos; - public int amount; + public float amount; - public ScrollEvent(PointF mousePos, int amount){ + public ScrollEvent(PointF mousePos, float amount){ this.amount = amount; this.pos = mousePos; } diff --git a/SPD-classes/src/main/java/com/watabou/utils/DeviceCompat.java b/SPD-classes/src/main/java/com/watabou/utils/DeviceCompat.java index 32ecc80ad..7827c91a7 100644 --- a/SPD-classes/src/main/java/com/watabou/utils/DeviceCompat.java +++ b/SPD-classes/src/main/java/com/watabou/utils/DeviceCompat.java @@ -64,7 +64,7 @@ public class DeviceCompat { } public static void openURI( String URI ){ - Game.platform.openURI(URI); + Gdx.net.openURI(URI); } public static void log( String tag, String message ){ diff --git a/SPD-classes/src/main/java/com/watabou/utils/PlatformSupport.java b/SPD-classes/src/main/java/com/watabou/utils/PlatformSupport.java index 3817c70e4..6478b528a 100644 --- a/SPD-classes/src/main/java/com/watabou/utils/PlatformSupport.java +++ b/SPD-classes/src/main/java/com/watabou/utils/PlatformSupport.java @@ -30,10 +30,6 @@ public abstract class PlatformSupport { public abstract void updateSystemUI(); public abstract boolean connectedToUnmeteredNetwork(); - - //FIXME this is a temporary method to workaround a bug in libGDX with Android 11+ - //it can be removed once Shattered is updated to libGDX 1.9.14+ - public abstract boolean openURI( String URI ); //FIXME this is currently used because no platform-agnostic text input has been implemented. //should look into doing that using either plain openGL or libgdx's libraries diff --git a/android/build.gradle b/android/build.gradle index 6888df33c..2a3be2f16 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -60,15 +60,11 @@ dependencies { implementation project(':core') implementation "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion" - implementation "com.badlogicgames.gdx:gdx-freetype:$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-x86" natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a" natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64" - implementation "com.badlogicgames.gdx:gdx-controllers:$gdxVersion" - implementation "com.badlogicgames.gdx:gdx-controllers-android:$gdxVersion" - natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi" + implementation "com.badlogicgames.gdx:gdx-freetype:$gdxVersion" natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi-v7a" natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-arm64-v8a" natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86" @@ -79,19 +75,17 @@ dependencies { // the natives configuration, and extracts them to the proper libs/ folders // so they get packed with the APK. task copyAndroidNatives() { - file("libs/armeabi/").mkdirs() file("libs/armeabi-v7a/").mkdirs() file("libs/arm64-v8a/").mkdirs() - file("libs/x86_64/").mkdirs() file("libs/x86/").mkdirs() + file("libs/x86_64/").mkdirs() configurations.natives.copy().files.each { jar -> def outputDir = null - if(jar.name.endsWith("natives-arm64-v8a.jar")) outputDir = file("libs/arm64-v8a") if(jar.name.endsWith("natives-armeabi-v7a.jar")) outputDir = file("libs/armeabi-v7a") - if(jar.name.endsWith("natives-armeabi.jar")) outputDir = file("libs/armeabi") - if(jar.name.endsWith("natives-x86_64.jar")) outputDir = file("libs/x86_64") + if(jar.name.endsWith("natives-arm64-v8a.jar")) outputDir = file("libs/arm64-v8a") if(jar.name.endsWith("natives-x86.jar")) outputDir = file("libs/x86") + if(jar.name.endsWith("natives-x86_64.jar")) outputDir = file("libs/x86_64") if(outputDir != null) { copy { from zipTree(jar) diff --git a/android/src/main/java/com/shatteredpixel/shatteredpixeldungeon/android/AndroidPlatformSupport.java b/android/src/main/java/com/shatteredpixel/shatteredpixeldungeon/android/AndroidPlatformSupport.java index f3595e982..5cbaf40a5 100644 --- a/android/src/main/java/com/shatteredpixel/shatteredpixeldungeon/android/AndroidPlatformSupport.java +++ b/android/src/main/java/com/shatteredpixel/shatteredpixeldungeon/android/AndroidPlatformSupport.java @@ -173,23 +173,6 @@ public class AndroidPlatformSupport extends PlatformSupport { } } - @Override - public boolean openURI(String URI) { - //copied from LibGDX 1.9.14 source - final Uri uri = Uri.parse(URI); - try { - Intent intent = new Intent(Intent.ACTION_VIEW, uri); - // LiveWallpaper and Daydream applications need this flag - if (!(((AndroidApplication)Gdx.app).getContext() instanceof Activity)) { - intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - } - ((AndroidApplication)Gdx.app).startActivity(intent); - return true; - } catch (ActivityNotFoundException e) { - return false; - } - } - @Override public void promptTextInput(final String title, final String hintText, final int maxLen, final boolean multiLine, final String posTxt, final String negTxt, final TextCallback callback) { Game.runOnRenderThread( new Callback() { diff --git a/build.gradle b/build.gradle index f233d0d5e..6f5095a01 100644 --- a/build.gradle +++ b/build.gradle @@ -20,10 +20,10 @@ allprojects { appJavaCompatibility = JavaVersion.VERSION_1_8 appAndroidCompileSDK = 30 - appAndroidMinSDK = 9 + appAndroidMinSDK = 14 appAndroidTargetSDK = 30 - gdxVersion = '1.9.10' + gdxVersion = '1.10.0' } version = appVersionName diff --git a/desktop/build.gradle b/desktop/build.gradle index 7661b0449..33b7a6ae9 100644 --- a/desktop/build.gradle +++ b/desktop/build.gradle @@ -63,10 +63,10 @@ dependencies { implementation "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop" //we use LWJGL tinyFD directly to display crash messages and (for now) single-line text input - implementation "org.lwjgl:lwjgl-tinyfd:3.2.1" - implementation "org.lwjgl:lwjgl-tinyfd:3.2.1:natives-windows" - implementation "org.lwjgl:lwjgl-tinyfd:3.2.1:natives-macos" - implementation "org.lwjgl:lwjgl-tinyfd:3.2.1:natives-linux" + implementation "org.lwjgl:lwjgl-tinyfd:3.2.3" + implementation "org.lwjgl:lwjgl-tinyfd:3.2.3:natives-windows" + implementation "org.lwjgl:lwjgl-tinyfd:3.2.3:natives-macos" + implementation "org.lwjgl:lwjgl-tinyfd:3.2.3:natives-linux" //Need these at compile time to prevent errors there. // The actual dependency used at runtime will vary based on source set. diff --git a/desktop/src/main/java/com/shatteredpixel/shatteredpixeldungeon/desktop/DesktopLauncher.java b/desktop/src/main/java/com/shatteredpixel/shatteredpixeldungeon/desktop/DesktopLauncher.java index 8f5d6d717..10854bd04 100644 --- a/desktop/src/main/java/com/shatteredpixel/shatteredpixeldungeon/desktop/DesktopLauncher.java +++ b/desktop/src/main/java/com/shatteredpixel/shatteredpixeldungeon/desktop/DesktopLauncher.java @@ -143,7 +143,12 @@ public class DesktopLauncher { config.setWindowSizeLimits( 480, 320, -1, -1 ); Point p = SPDSettings.windowResolution(); config.setWindowedMode( p.x, p.y ); - config.setAutoIconify( true ); + + config.setMaximized(SPDSettings.windowMaximized()); + + if (SPDSettings.fullscreen()) { + config.setFullscreenMode(Lwjgl3ApplicationConfiguration.getDisplayMode()); + } //we set fullscreen/maximized in the listener as doing it through the config seems to be buggy DesktopWindowListener listener = new DesktopWindowListener(); diff --git a/desktop/src/main/java/com/shatteredpixel/shatteredpixeldungeon/desktop/DesktopPlatformSupport.java b/desktop/src/main/java/com/shatteredpixel/shatteredpixeldungeon/desktop/DesktopPlatformSupport.java index 2ab64c691..affbe7a71 100644 --- a/desktop/src/main/java/com/shatteredpixel/shatteredpixeldungeon/desktop/DesktopPlatformSupport.java +++ b/desktop/src/main/java/com/shatteredpixel/shatteredpixeldungeon/desktop/DesktopPlatformSupport.java @@ -41,6 +41,7 @@ public class DesktopPlatformSupport extends PlatformSupport { @Override public void updateDisplaySize() { + //FIXME we still set window resolution when game becomes maximized =/ if (!SPDSettings.fullscreen()) { SPDSettings.windowResolution( new Point( Game.width, Game.height ) ); } @@ -66,11 +67,6 @@ public class DesktopPlatformSupport extends PlatformSupport { return true; //no easy way to check this in desktop, just assume user doesn't care } - @Override - public boolean openURI(String URI) { - return Gdx.net.openURI(URI); - } - @Override //FIXME tinyfd_inputBox isn't a full solution for this. No support for multiline, looks ugly. Ideally we'd have an opengl-based input box public void promptTextInput(String title, String hintText, int maxLen, boolean multiLine, String posTxt, String negTxt, TextCallback callback) { diff --git a/desktop/src/main/java/com/shatteredpixel/shatteredpixeldungeon/desktop/DesktopWindowListener.java b/desktop/src/main/java/com/shatteredpixel/shatteredpixeldungeon/desktop/DesktopWindowListener.java index e9b7066eb..00b35a79e 100644 --- a/desktop/src/main/java/com/shatteredpixel/shatteredpixeldungeon/desktop/DesktopWindowListener.java +++ b/desktop/src/main/java/com/shatteredpixel/shatteredpixeldungeon/desktop/DesktopWindowListener.java @@ -29,19 +29,7 @@ import com.shatteredpixel.shatteredpixeldungeon.SPDSettings; public class DesktopWindowListener implements Lwjgl3WindowListener { @Override - public void created ( Lwjgl3Window lwjgl3Window ) { - if (SPDSettings.fullscreen()){ - lwjgl3Window.postRunnable( new Runnable() { - @Override - public void run () { - Gdx.graphics.setFullscreenMode( Gdx.graphics.getDisplayMode() ); - } - } ); - } - if (SPDSettings.windowMaximized()) { - lwjgl3Window.maximizeWindow(); - } - } + public void created ( Lwjgl3Window lwjgl3Window ) { } @Override public void maximized ( boolean b ) {