diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml index bfa530d87..8c1fe44e9 100644 --- a/android/src/main/AndroidManifest.xml +++ b/android/src/main/AndroidManifest.xml @@ -33,20 +33,15 @@ android:fullBackupOnly="true" android:backupAgent=".AndroidBackupHandler"> - - diff --git a/android/src/main/java/com/shatteredpixel/shatteredpixeldungeon/android/AndroidGame.java b/android/src/main/java/com/shatteredpixel/shatteredpixeldungeon/android/AndroidGame.java index 689321350..b5832bc83 100644 --- a/android/src/main/java/com/shatteredpixel/shatteredpixeldungeon/android/AndroidGame.java +++ b/android/src/main/java/com/shatteredpixel/shatteredpixeldungeon/android/AndroidGame.java @@ -24,15 +24,20 @@ package com.shatteredpixel.shatteredpixeldungeon.android; import android.content.Context; import android.content.pm.ActivityInfo; import android.content.pm.PackageManager; +import android.graphics.Typeface; import android.os.Build; import android.os.Bundle; +import android.view.Gravity; import android.view.ViewConfiguration; +import android.widget.TextView; import com.badlogic.gdx.Files; import com.badlogic.gdx.backends.android.AndroidApplication; import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration; import com.badlogic.gdx.backends.android.AndroidAudio; import com.badlogic.gdx.backends.android.AsynchronousAndroidAudio; +import com.badlogic.gdx.graphics.g2d.freetype.FreeType; +import com.badlogic.gdx.utils.GdxNativesLoader; import com.shatteredpixel.shatteredpixeldungeon.SPDSettings; import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.services.news.News; @@ -53,6 +58,24 @@ public class AndroidGame extends AndroidApplication { protected void onCreate (Bundle savedInstanceState) { super.onCreate(savedInstanceState); + try { + GdxNativesLoader.load(); + FreeType.initFreeType(); + } catch (Exception e){ + TextView text = new TextView(this); + text.setText("Shattered Pixel Dungeon cannot start because some of its code is missing!\n\n" + + "This usually happens when the Google Play version of the game is installed from somewhere outside of Google Play.\n\n" + + "If you're unsure of how to fix this, please email the developer (Evan@ShatteredPixel.com), and include this error message:\n\n" + + e.getMessage()); + text.setTextSize(16); + text.setTextColor(0xFFFFFFFF); + text.setTypeface(Typeface.createFromAsset(getAssets(), "fonts/pixel_font.ttf")); + text.setGravity(Gravity.CENTER_VERTICAL); + text.setPadding(10, 10, 10, 10); + setContentView(text); + return; + } + //there are some things we only need to set up on first launch if (instance == null) { diff --git a/android/src/main/java/com/shatteredpixel/shatteredpixeldungeon/android/AndroidLauncher.java b/android/src/main/java/com/shatteredpixel/shatteredpixeldungeon/android/AndroidLauncher.java deleted file mode 100644 index 68d2e6f39..000000000 --- a/android/src/main/java/com/shatteredpixel/shatteredpixeldungeon/android/AndroidLauncher.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Pixel Dungeon - * Copyright (C) 2012-2015 Oleg Dolya - * - * Shattered Pixel Dungeon - * Copyright (C) 2014-2022 Evan Debenham - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see - */ - -package com.shatteredpixel.shatteredpixeldungeon.android; - -import android.annotation.SuppressLint; -import android.app.Activity; -import android.content.Intent; -import android.graphics.Typeface; -import android.os.Bundle; -import android.view.Gravity; -import android.widget.TextView; - -import com.badlogic.gdx.graphics.g2d.freetype.FreeType; -import com.badlogic.gdx.utils.GdxNativesLoader; - -public class AndroidLauncher extends Activity { - - @SuppressLint("SetTextI18n") - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - try { - GdxNativesLoader.load(); - FreeType.initFreeType(); - - Intent intent = new Intent(this, AndroidGame.class); - startActivity(intent); - finish(); - } catch (Exception e){ - TextView text = new TextView(this); - text.setText("Shattered Pixel Dungeon cannot start because some of its code is missing!\n\n" + - "This usually happens when the Google Play version of the game is installed from somewhere outside of Google Play.\n\n" + - "If you're unsure of how to fix this, please email the developer (Evan@ShatteredPixel.com), and include this error message:\n\n" + - e.getMessage()); - text.setTextSize(16); - text.setTextColor(0xFFFFFFFF); - text.setTypeface(Typeface.createFromAsset(getAssets(), "fonts/pixel_font.ttf")); - text.setGravity(Gravity.CENTER_VERTICAL); - text.setPadding(10, 10, 10, 10); - setContentView(text); - } - } -} diff --git a/build.gradle b/build.gradle index ff698f062..0e850bb29 100644 --- a/build.gradle +++ b/build.gradle @@ -23,7 +23,7 @@ allprojects { appAndroidMinSDK = 14 appAndroidTargetSDK = 31 - gdxVersion = '1.10.0' + gdxVersion = '1.11.0' gdxControllersVersion = '2.2.1' robovmVersion = '2.3.16' } diff --git a/desktop/build.gradle b/desktop/build.gradle index 5e35d7017..f1f2e251b 100644 --- a/desktop/build.gradle +++ b/desktop/build.gradle @@ -122,10 +122,10 @@ dependencies { implementation "com.badlogicgames.gdx-controllers:gdx-controllers-desktop:$gdxControllersVersion" //we use LWJGL tinyFD directly to display crash messages and (for now) single-line text input - 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" + implementation "org.lwjgl:lwjgl-tinyfd:3.3.1" + implementation "org.lwjgl:lwjgl-tinyfd:3.3.1:natives-windows" + implementation "org.lwjgl:lwjgl-tinyfd:3.3.1:natives-macos" + implementation "org.lwjgl:lwjgl-tinyfd:3.3.1:natives-linux" implementation project(':services:updates:githubUpdates') implementation project(':services:news:shatteredNews') 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 13b80ad6a..838905f83 100644 --- a/desktop/src/main/java/com/shatteredpixel/shatteredpixeldungeon/desktop/DesktopLauncher.java +++ b/desktop/src/main/java/com/shatteredpixel/shatteredpixeldungeon/desktop/DesktopLauncher.java @@ -89,13 +89,13 @@ public class DesktopLauncher { if (exceptionMsg.contains("Couldn't create window")){ TinyFileDialogs.tinyfd_messageBox(title + " Has Crashed!", - title + " wasn't able to initialize it's graphics display, sorry about that!\n\n" + - "This usually happens when a computer's graphics card does not support OpenGL 2.0+, or has misconfigured graphics drivers.\n\n" + - "If you're certain the game should be working on your computer, feel free to message the developer (Evan@ShatteredPixel.com)\n\n" + + title + " was not able to initialize its graphics display, sorry about that!\n\n" + + "This usually happens when your graphics card does not support OpenGL 2.0+, or has misconfigured graphics drivers.\n\n" + + "If you are certain the game should be working on your computer, feel free to message the developer (Evan@ShatteredPixel.com)\n\n" + "version: " + Game.version, "ok", "error", false); } else { TinyFileDialogs.tinyfd_messageBox(title + " Has Crashed!", - title + " has run into an error it can't recover from and has crashed, sorry about that!\n\n" + + title + " has run into an error it cannot recover from and has crashed, sorry about that!\n\n" + "If you could, please email this error message to the developer (Evan@ShatteredPixel.com):\n\n" + "version: " + Game.version + "\n" + exceptionMsg, 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 5af8e8e1f..8498fa717 100644 --- a/desktop/src/main/java/com/shatteredpixel/shatteredpixeldungeon/desktop/DesktopPlatformSupport.java +++ b/desktop/src/main/java/com/shatteredpixel/shatteredpixeldungeon/desktop/DesktopPlatformSupport.java @@ -77,33 +77,6 @@ public class DesktopPlatformSupport extends PlatformSupport { return true; //no easy way to check this in desktop, just assume user doesn't care } - //TODO backported openURI fix from libGDX-1.10.1-SNAPSHOT, remove when updating libGDX - public boolean openURI( String uri ){ - if (SharedLibraryLoader.isMac) { - try { - (new ProcessBuilder("open", (new URI(uri).toString()))).start(); - return true; - } catch (Throwable t) { - return false; - } - } else if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) { - try { - Desktop.getDesktop().browse(new URI(uri)); - return true; - } catch (Throwable t) { - return false; - } - } else if (SharedLibraryLoader.isLinux) { - try { - (new ProcessBuilder("xdg-open", (new URI(uri).toString()))).start(); - return true; - } catch (Throwable t) { - return false; - } - } - return false; - } - /* FONT SUPPORT */ //custom pixel font, for use with Latin and Cyrillic languages