v0.8.0: improved desktop debugRun task, version info is now dynamic
This commit is contained in:
+18
-20
@@ -35,6 +35,8 @@ import javax.swing.JOptionPane;
|
||||
public class DesktopLauncher {
|
||||
public static void main (String[] arg) {
|
||||
|
||||
final LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
|
||||
|
||||
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
|
||||
@Override
|
||||
public void uncaughtException(Thread thread, Throwable throwable) {
|
||||
@@ -42,14 +44,28 @@ public class DesktopLauncher {
|
||||
PrintWriter pw = new PrintWriter(sw);
|
||||
throwable.printStackTrace(pw);
|
||||
pw.flush();
|
||||
JOptionPane.showMessageDialog(null, "Shattered Pixel Dungeon has crashed, sorry about that!\n\n" +
|
||||
JOptionPane.showMessageDialog(null, config.title + " has crashed, sorry about that!\n\n" +
|
||||
"If you could, please email this error message to me and I'll get it fixed (Evan@ShatteredPixel.com):\n\n" +
|
||||
sw.toString(), "Game Crash!", JOptionPane.ERROR_MESSAGE);
|
||||
Gdx.app.exit();
|
||||
}
|
||||
});
|
||||
|
||||
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
|
||||
config.title = DesktopLauncher.class.getPackage().getSpecificationTitle();
|
||||
if (config.title == null) {
|
||||
config.title = System.getProperty("Specification-Name");
|
||||
}
|
||||
|
||||
Game.version = DesktopLauncher.class.getPackage().getSpecificationVersion();
|
||||
if (Game.version == null) {
|
||||
Game.version = System.getProperty("Specification-Version");
|
||||
}
|
||||
|
||||
try {
|
||||
Game.versionCode = Integer.parseInt(DesktopLauncher.class.getPackage().getImplementationVersion());
|
||||
} catch (NumberFormatException e) {
|
||||
Game.versionCode = Integer.parseInt(System.getProperty("Implementation-Version"));
|
||||
}
|
||||
|
||||
config.width = 1920;
|
||||
config.height = 1080;
|
||||
@@ -58,24 +74,6 @@ public class DesktopLauncher {
|
||||
config.foregroundFPS = 0;
|
||||
config.backgroundFPS = -1;
|
||||
|
||||
//TODO rather than hardcoding these values when running debug
|
||||
// it would be nice to be able to fetch them from gradle in some way
|
||||
config.title = DesktopLauncher.class.getPackage().getSpecificationTitle();
|
||||
if (config.title == null) {
|
||||
config.title = "ShatteredPD INDEV";
|
||||
}
|
||||
|
||||
Game.version = DesktopLauncher.class.getPackage().getSpecificationVersion();
|
||||
if (Game.version == null) {
|
||||
Game.version = "0.7.5e-INDEV";
|
||||
}
|
||||
|
||||
try {
|
||||
Game.versionCode = Integer.parseInt(DesktopLauncher.class.getPackage().getImplementationVersion());
|
||||
} catch (NumberFormatException e) {
|
||||
Game.versionCode = 382;
|
||||
}
|
||||
|
||||
new LwjglApplication(new ShatteredPixelDungeon(new DesktopPlatformSupport()), config);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user