Add error traps to main render and resize functions

This commit is contained in:
drdev
2014-04-15 00:12:33 +00:00
parent 41c074efb8
commit ce796fa073

View File

@@ -123,15 +123,22 @@ public class Forge implements ApplicationListener {
}
private static void setCurrentScreen(FScreen screen0) {
try {
Animation.endAll(); //end all active animations before switching screens
currentScreen = screen0;
currentScreen.setSize(screenWidth, screenHeight);
currentScreen.onActivate();
}
catch (Exception ex) {
batch.end();
BugReporter.reportException(ex);
}
}
@Override
public void render() {
try {
Animation.advanceAll();
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); // Clear the screen.
@@ -153,9 +160,15 @@ public class Forge implements ApplicationListener {
}
batch.end();
}
catch (Exception ex) {
batch.end();
BugReporter.reportException(ex);
}
}
@Override
public void resize(int width, int height) {
try {
screenWidth = width;
screenHeight = height;
if (currentScreen != null) {
@@ -165,6 +178,11 @@ public class Forge implements ApplicationListener {
splashScreen.setSize(width, height);
}
}
catch (Exception ex) {
batch.end();
BugReporter.reportException(ex);
}
}
@Override
public void pause() {