summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/ch/asynk')
-rw-r--r--core/src/ch/asynk/rustanddust/RustAndDust.java2
-rw-r--r--core/src/ch/asynk/rustanddust/screens/GameScreen.java13
2 files changed, 13 insertions, 2 deletions
diff --git a/core/src/ch/asynk/rustanddust/RustAndDust.java b/core/src/ch/asynk/rustanddust/RustAndDust.java
index 1d8cd70..9334123 100644
--- a/core/src/ch/asynk/rustanddust/RustAndDust.java
+++ b/core/src/ch/asynk/rustanddust/RustAndDust.java
@@ -255,11 +255,13 @@ public class RustAndDust extends Game
public void pause()
{
debug("RustAndDust", "pause()");
+ getScreen().pause();
}
@Override
public void resume()
{
debug("RustAndDust", "resume()");
+ getScreen().resume();
}
}
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;
}
}