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:backupAgent=".AndroidBackupHandler">
<activity
android:label="${appName}"
android:name=".AndroidLauncher"
android:name=".AndroidGame"
android:screenOrientation="nosensor"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:label="${appName}"
android:name=".AndroidGame"
android:screenOrientation="nosensor"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize">
</activity>
</application>

View File

@@ -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) {

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);
}
}
}