mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 18:28:00 +00:00
Add error traps to main render and resize functions
This commit is contained in:
@@ -123,46 +123,64 @@ public class Forge implements ApplicationListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void setCurrentScreen(FScreen screen0) {
|
private static void setCurrentScreen(FScreen screen0) {
|
||||||
Animation.endAll(); //end all active animations before switching screens
|
try {
|
||||||
|
Animation.endAll(); //end all active animations before switching screens
|
||||||
|
|
||||||
currentScreen = screen0;
|
currentScreen = screen0;
|
||||||
currentScreen.setSize(screenWidth, screenHeight);
|
currentScreen.setSize(screenWidth, screenHeight);
|
||||||
currentScreen.onActivate();
|
currentScreen.onActivate();
|
||||||
|
}
|
||||||
|
catch (Exception ex) {
|
||||||
|
batch.end();
|
||||||
|
BugReporter.reportException(ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render() {
|
public void render() {
|
||||||
Animation.advanceAll();
|
try {
|
||||||
|
Animation.advanceAll();
|
||||||
|
|
||||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); // Clear the screen.
|
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); // Clear the screen.
|
||||||
|
|
||||||
FContainer screen = currentScreen;
|
FContainer screen = currentScreen;
|
||||||
if (screen == null) {
|
|
||||||
screen = splashScreen;
|
|
||||||
if (screen == null) {
|
if (screen == null) {
|
||||||
return;
|
screen = splashScreen;
|
||||||
|
if (screen == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
batch.begin();
|
batch.begin();
|
||||||
Graphics g = new Graphics();
|
Graphics g = new Graphics();
|
||||||
screen.draw(g);
|
screen.draw(g);
|
||||||
for (FOverlay overlay : FOverlay.getOverlays()) {
|
for (FOverlay overlay : FOverlay.getOverlays()) {
|
||||||
overlay.setSize(screenWidth, screenHeight); //update overlay sizes as they're rendered
|
overlay.setSize(screenWidth, screenHeight); //update overlay sizes as they're rendered
|
||||||
overlay.draw(g);
|
overlay.draw(g);
|
||||||
|
}
|
||||||
|
batch.end();
|
||||||
|
}
|
||||||
|
catch (Exception ex) {
|
||||||
|
batch.end();
|
||||||
|
BugReporter.reportException(ex);
|
||||||
}
|
}
|
||||||
batch.end();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void resize(int width, int height) {
|
public void resize(int width, int height) {
|
||||||
screenWidth = width;
|
try {
|
||||||
screenHeight = height;
|
screenWidth = width;
|
||||||
if (currentScreen != null) {
|
screenHeight = height;
|
||||||
currentScreen.setSize(width, height);
|
if (currentScreen != null) {
|
||||||
|
currentScreen.setSize(width, height);
|
||||||
|
}
|
||||||
|
else if (splashScreen != null) {
|
||||||
|
splashScreen.setSize(width, height);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (splashScreen != null) {
|
catch (Exception ex) {
|
||||||
splashScreen.setSize(width, height);
|
batch.end();
|
||||||
|
BugReporter.reportException(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user