X-Git-Url: https://deadsoftware.ru/gitweb?a=blobdiff_plain;f=core%2Fsrc%2Fru%2Fdeadsoftware%2Fcavecraft%2FGameScreen.java;h=209d32bb058b39ea8d62d5087e667ee6142e7fc6;hb=40312aaac2ec8bd1247ad5979f7bd1d8e47ecae3;hp=3301805e5854acafb14a33263b1e32ec447167b6;hpb=48de33432d9615967da21b22b950bd526b330572;p=cavedroid.git diff --git a/core/src/ru/deadsoftware/cavecraft/GameScreen.java b/core/src/ru/deadsoftware/cavecraft/GameScreen.java index 3301805..209d32b 100644 --- a/core/src/ru/deadsoftware/cavecraft/GameScreen.java +++ b/core/src/ru/deadsoftware/cavecraft/GameScreen.java @@ -9,6 +9,8 @@ import ru.deadsoftware.cavecraft.game.GameProc; public class GameScreen implements Screen { + public static int FPS; + private GameProc gameProc; private GameInputHandler gameInput; @@ -35,6 +37,7 @@ public class GameScreen implements Screen { @Override public void render(float delta) { + FPS = (int)(1/delta); gameProc.update(delta); gameProc.renderer.render(); } @@ -68,7 +71,12 @@ public class GameScreen implements Screen { @Override public boolean keyDown(int keycode) { - gameInput.keyDown(keycode); + if (keycode == Input.Keys.N) { + gameProc = new GameProc(); + gameInput = new GameInputHandler(gameProc); + } else { + gameInput.keyDown(keycode); + } return false; }