From b0043fe89ed3ebd843fc014e7b83a63ca1a5730d Mon Sep 17 00:00:00 2001 From: Armin Benz Date: Sun, 16 Apr 2017 18:56:03 +0200 Subject: [PATCH] Backkey nur inGame, Last Best Ingame --- .../de/samdev/colorrunner/game/renderer/CRGameRenderer.java | 4 +++- core/src/de/samdev/colorrunner/game/world/CRGameWorld.java | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/core/src/de/samdev/colorrunner/game/renderer/CRGameRenderer.java b/core/src/de/samdev/colorrunner/game/renderer/CRGameRenderer.java index d4f2aa0..769a6bb 100644 --- a/core/src/de/samdev/colorrunner/game/renderer/CRGameRenderer.java +++ b/core/src/de/samdev/colorrunner/game/renderer/CRGameRenderer.java @@ -1,6 +1,7 @@ package de.samdev.colorrunner.game.renderer; import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.Preferences; import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType; import com.badlogic.gdx.math.Vector2; @@ -16,6 +17,7 @@ import de.samdev.colorrunner.game.world.map.provider.StaticMapProvider; public class CRGameRenderer extends AbstractGameRenderer { private CRGameWorld gameworld; public double avgExecTime = 0; + private Preferences endlessGameInfos = Gdx.app.getPreferences("endlessGameInfos"); public CRGameRenderer(CRGameWorld _world, float width, float height) { super(width, height); @@ -94,7 +96,7 @@ public class CRGameRenderer extends AbstractGameRenderer { private void renderHud(){ beginHud(); renderHud("Points: " + gameworld.scoreMeter, 10); - renderHud("Time:", (Gdx.graphics.getWidth() / 2) - 10); + renderHud("Last Best: " + endlessGameInfos.getInteger("lastBest", 0), (Gdx.graphics.getWidth() / 2) - 10); if (gameworld.mapprovider instanceof EndlessMapProvider)renderDebug("Procedural Piece: \"" + ((EndlessMapProvider)gameworld.mapprovider).getCurrentSection(gameworld.player.bounds).piece_name + "\""); endHud(); } diff --git a/core/src/de/samdev/colorrunner/game/world/CRGameWorld.java b/core/src/de/samdev/colorrunner/game/world/CRGameWorld.java index 5bf2b2c..230311b 100644 --- a/core/src/de/samdev/colorrunner/game/world/CRGameWorld.java +++ b/core/src/de/samdev/colorrunner/game/world/CRGameWorld.java @@ -59,8 +59,10 @@ public class CRGameWorld implements GameInputListener { fps.Inc(); Gdx.input.setCatchBackKey(true); - if(Gdx.input.isKeyPressed(Input.Keys.BACK) || Gdx.input.isKeyPressed(Input.Keys.BACKSPACE)) + if(Gdx.input.isKeyPressed(Input.Keys.BACK) || Gdx.input.isKeyPressed(Input.Keys.BACKSPACE)) { + Gdx.input.setCatchBackKey(false); ((Game) Gdx.app.getApplicationListener()).setScreen(new EndlessGameMenu(music)); + } for (int i = entities.size()-1; i >= 0; i--) { CRGameEntity ent = entities.get(i);