v1.3.0: updated libGDX to 1.11.0

This commit is contained in:
Evan Debenham
2022-05-13 13:07:21 -04:00
parent b6471276e2
commit b4713369bf
7 changed files with 35 additions and 107 deletions

View File

@@ -33,20 +33,15 @@
android:fullBackupOnly="true" android:fullBackupOnly="true"
android:backupAgent=".AndroidBackupHandler"> android:backupAgent=".AndroidBackupHandler">
<activity <activity
android:label="${appName}" android:name=".AndroidGame"
android:name=".AndroidLauncher" android:screenOrientation="nosensor"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize"
android:exported="true"> android:exported="true">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity
android:label="${appName}"
android:name=".AndroidGame"
android:screenOrientation="nosensor"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize">
</activity>
</application> </application>

View File

@@ -24,15 +24,20 @@ package com.shatteredpixel.shatteredpixeldungeon.android;
import android.content.Context; import android.content.Context;
import android.content.pm.ActivityInfo; import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.graphics.Typeface;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.view.Gravity;
import android.view.ViewConfiguration; import android.view.ViewConfiguration;
import android.widget.TextView;
import com.badlogic.gdx.Files; import com.badlogic.gdx.Files;
import com.badlogic.gdx.backends.android.AndroidApplication; import com.badlogic.gdx.backends.android.AndroidApplication;
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration; import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
import com.badlogic.gdx.backends.android.AndroidAudio; import com.badlogic.gdx.backends.android.AndroidAudio;
import com.badlogic.gdx.backends.android.AsynchronousAndroidAudio; 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.SPDSettings;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.shatteredpixel.shatteredpixeldungeon.services.news.News; import com.shatteredpixel.shatteredpixeldungeon.services.news.News;
@@ -53,6 +58,24 @@ public class AndroidGame extends AndroidApplication {
protected void onCreate (Bundle savedInstanceState) { protected void onCreate (Bundle savedInstanceState) {
super.onCreate(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 //there are some things we only need to set up on first launch
if (instance == null) { if (instance == null) {

View File

@@ -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 <http://www.gnu.org/licenses/>
*/
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);
}
}
}

View File

@@ -23,7 +23,7 @@ allprojects {
appAndroidMinSDK = 14 appAndroidMinSDK = 14
appAndroidTargetSDK = 31 appAndroidTargetSDK = 31
gdxVersion = '1.10.0' gdxVersion = '1.11.0'
gdxControllersVersion = '2.2.1' gdxControllersVersion = '2.2.1'
robovmVersion = '2.3.16' robovmVersion = '2.3.16'
} }

View File

@@ -122,10 +122,10 @@ dependencies {
implementation "com.badlogicgames.gdx-controllers:gdx-controllers-desktop:$gdxControllersVersion" 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 //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.3.1"
implementation "org.lwjgl:lwjgl-tinyfd:3.2.3:natives-windows" implementation "org.lwjgl:lwjgl-tinyfd:3.3.1:natives-windows"
implementation "org.lwjgl:lwjgl-tinyfd:3.2.3:natives-macos" implementation "org.lwjgl:lwjgl-tinyfd:3.3.1:natives-macos"
implementation "org.lwjgl:lwjgl-tinyfd:3.2.3:natives-linux" implementation "org.lwjgl:lwjgl-tinyfd:3.3.1:natives-linux"
implementation project(':services:updates:githubUpdates') implementation project(':services:updates:githubUpdates')
implementation project(':services:news:shatteredNews') implementation project(':services:news:shatteredNews')

View File

@@ -89,13 +89,13 @@ public class DesktopLauncher {
if (exceptionMsg.contains("Couldn't create window")){ if (exceptionMsg.contains("Couldn't create window")){
TinyFileDialogs.tinyfd_messageBox(title + " Has Crashed!", TinyFileDialogs.tinyfd_messageBox(title + " Has Crashed!",
title + " wasn't able to initialize it's graphics display, sorry about that!\n\n" + title + " was not able to initialize its 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" + "This usually happens when your 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" + "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); "version: " + Game.version, "ok", "error", false);
} else { } else {
TinyFileDialogs.tinyfd_messageBox(title + " Has Crashed!", 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" + "If you could, please email this error message to the developer (Evan@ShatteredPixel.com):\n\n" +
"version: " + Game.version + "\n" + "version: " + Game.version + "\n" +
exceptionMsg, exceptionMsg,

View File

@@ -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 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 */ /* FONT SUPPORT */
//custom pixel font, for use with Latin and Cyrillic languages //custom pixel font, for use with Latin and Cyrillic languages