Backkey nur inGame, Last Best Ingame

This commit is contained in:
Armin Benz 2017-04-16 18:56:03 +02:00
parent ee5f14665f
commit b0043fe89e
2 changed files with 6 additions and 2 deletions

View File

@ -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();
}

View File

@ -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);