summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/rustanddust/screens
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2016-01-06 20:11:28 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2016-01-06 20:11:28 +0100
commitabd0ea69183a36c6a3e818edcdc1883a97be8b3a (patch)
tree48699ea987c43a8d55beb0276f487a3ca254144b /core/src/ch/asynk/rustanddust/screens
parent6972a5e1aa691cb87eacf24eb7f14734b7834c7b (diff)
downloadRustAndDust-abd0ea69183a36c6a3e818edcdc1883a97be8b3a.zip
RustAndDust-abd0ea69183a36c6a3e818edcdc1883a97be8b3a.tar.gz
GameScreen: do not render or resize when on pause
Diffstat (limited to 'core/src/ch/asynk/rustanddust/screens')
-rw-r--r--core/src/ch/asynk/rustanddust/screens/GameScreen.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/core/src/ch/asynk/rustanddust/screens/GameScreen.java b/core/src/ch/asynk/rustanddust/screens/GameScreen.java
index 6c58c1b..a1e759f 100644
--- a/core/src/ch/asynk/rustanddust/screens/GameScreen.java
+++ b/core/src/ch/asynk/rustanddust/screens/GameScreen.java
@@ -41,6 +41,7 @@ public class GameScreen implements Screen
private final RustAndDust game;
private Ctrl ctrl;
+ private boolean paused;
private int dragged;
private boolean blocked;
private float inputDelay = 0f;
@@ -63,6 +64,8 @@ public class GameScreen implements Screen
if (DEBUG) this.debugShapes = new ShapeRenderer();
Gdx.input.setInputProcessor(getMultiplexer());
+
+ paused = false;
}
private InputMultiplexer getMultiplexer()
@@ -138,6 +141,8 @@ public class GameScreen implements Screen
@Override
public void render(float delta)
{
+ if (paused) return;
+
if (inputDelay > 0f) {
inputDelay -= delta;
if (inputDelay <= 0f)
@@ -186,6 +191,8 @@ public class GameScreen implements Screen
@Override
public void resize(int width, int height)
{
+ if (paused) return;
+
// RustAndDust.debug("GameScreen", "resize (" + width + "," + height + ")");
cam.updateViewport(width, height);
ctrl.hud.resize(cam.getHudLeft(), cam.getHudBottom(), cam.getHudWidth(), cam.getHudHeight());
@@ -215,12 +222,14 @@ public class GameScreen implements Screen
@Override
public void pause()
{
- // RustAndDust.debug("GameScreen", "pause()");
+ paused = true;
+ RustAndDust.debug("RustAndDust", "pause() ");
}
@Override
public void resume()
{
- // RustAndDust.debug("GameScreen", "resume()");
+ RustAndDust.debug("RustAndDust", "resume() ");
+ paused = false;
}
}