diff --git a/core/src/com/riiablo/Keys.java b/core/src/com/riiablo/Keys.java index 4d1ca724..5307ac06 100644 --- a/core/src/com/riiablo/Keys.java +++ b/core/src/com/riiablo/Keys.java @@ -35,6 +35,7 @@ public class Keys { private Keys() {} public static final MappedKey Console = new MappedKey("Console", "console", Input.Keys.GRAVE); + public static final MappedKey DebugMode = new MappedKey("Debug Mode", "debug", Input.Keys.F12); public static final MappedKey Esc = new MappedKey("Esc", "esc", Input.Keys.ESCAPE, Input.Keys.BACK); public static final MappedKey Inventory = new MappedKey("Inventory", "inventory", Input.Keys.I, Input.Keys.B); public static final MappedKey Character = new MappedKey("Character", "character", Input.Keys.C, Input.Keys.A); diff --git a/core/src/com/riiablo/screen/ClientScreen.java b/core/src/com/riiablo/screen/ClientScreen.java index 44f4717f..79e60cee 100644 --- a/core/src/com/riiablo/screen/ClientScreen.java +++ b/core/src/com/riiablo/screen/ClientScreen.java @@ -111,6 +111,13 @@ public class ClientScreen extends ScreenAdapter implements LoadingScreen.Loadabl Stage stage; Viewport viewport; + boolean isDebug; + MappedKeyStateAdapter debugKeyListener = new MappedKeyStateAdapter() { + @Override + public void onPressed(MappedKey key, int keycode) { + isDebug = !isDebug; + } + }; Engine engine; RenderSystem renderer; @@ -483,7 +490,7 @@ public class ClientScreen extends ScreenAdapter implements LoadingScreen.Loadabl batch.end(); - if (Gdx.app.getType() != Application.ApplicationType.Android) { + if (isDebug) { ShapeRenderer shapes = Riiablo.shapes; shapes.identity(); shapes.setProjectionMatrix(iso.combined); @@ -550,6 +557,8 @@ public class ClientScreen extends ScreenAdapter implements LoadingScreen.Loadabl @Override public void show() { + isDebug = DEBUG && Gdx.app.getType() == Application.ApplicationType.Desktop; + Keys.DebugMode.addStateListener(debugKeyListener); Keys.Esc.addStateListener(mappedKeyStateListener); Keys.Enter.addStateListener(mappedKeyStateListener); Keys.Inventory.addStateListener(mappedKeyStateListener); @@ -640,6 +649,7 @@ public class ClientScreen extends ScreenAdapter implements LoadingScreen.Loadabl @Override public void hide() { + Keys.DebugMode.removeStateListener(debugKeyListener); Keys.Esc.removeStateListener(mappedKeyStateListener); Keys.Enter.removeStateListener(mappedKeyStateListener); Keys.Inventory.removeStateListener(mappedKeyStateListener);