From c8179b8e27dd69a0e3728c98ef32aecc6123df88 Mon Sep 17 00:00:00 2001 From: EpicKnarvik97 Date: Wed, 26 Feb 2020 09:17:06 +0100 Subject: [PATCH] Gjenoppretter elementer fjernet under opprydding --- .../inf112/fiasko/roborally/GameLauncher.java | 17 ++++++++++++++-- .../roborally/element_properties/Action.java | 14 +++++++++++++ .../roborally/objects/ICardWithoutSuit.java | 20 +++++++++++++++++++ 3 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 src/main/java/inf112/fiasko/roborally/element_properties/Action.java create mode 100644 src/main/java/inf112/fiasko/roborally/objects/ICardWithoutSuit.java diff --git a/src/main/java/inf112/fiasko/roborally/GameLauncher.java b/src/main/java/inf112/fiasko/roborally/GameLauncher.java index f2d71b5..c95c235 100644 --- a/src/main/java/inf112/fiasko/roborally/GameLauncher.java +++ b/src/main/java/inf112/fiasko/roborally/GameLauncher.java @@ -42,6 +42,8 @@ public class GameLauncher extends ApplicationAdapter { camera.setToOrtho(false, game.getWidth() * tileDimensions, game.getHeight() * tileDimensions); batch = new SpriteBatch(); + /*MyTextInputListener listener = new MyTextInputListener(); + Gdx.input.getTextInput(listener, "Input name", "", "Name");*/ } /** @@ -67,10 +69,10 @@ public class GameLauncher extends ApplicationAdapter { object.flipX(), object.flipY()); } batch.end(); - if (Gdx.input.isKeyPressed(Input.Keys.CONTROL_LEFT) && Gdx.input.isKeyPressed(Input.Keys.PLUS) && cameraZoom > 0) { + if (Gdx.input.isKeyJustPressed(Input.Keys.CONTROL_LEFT) && Gdx.input.isKeyJustPressed(Input.Keys.PLUS) && cameraZoom > 0) { cameraZoom -= 0.1; } - if (Gdx.input.isKeyPressed(Input.Keys.CONTROL_LEFT) && Gdx.input.isKeyPressed(Input.Keys.MINUS) && cameraZoom < 2) { + if (Gdx.input.isKeyJustPressed(Input.Keys.CONTROL_LEFT) && Gdx.input.isKeyJustPressed(Input.Keys.MINUS) && cameraZoom < 2) { cameraZoom += 0.1; } if (Gdx.input.isKeyJustPressed(Input.Keys.RIGHT)) { @@ -84,4 +86,15 @@ public class GameLauncher extends ApplicationAdapter { textureSheet.dispose(); batch.dispose(); } + + /*public static class MyTextInputListener implements Input.TextInputListener { + @Override + public void input (String text) { + System.out.println(text); + } + + @Override + public void canceled () { + } + }*/ } \ No newline at end of file diff --git a/src/main/java/inf112/fiasko/roborally/element_properties/Action.java b/src/main/java/inf112/fiasko/roborally/element_properties/Action.java new file mode 100644 index 0000000..5c42c89 --- /dev/null +++ b/src/main/java/inf112/fiasko/roborally/element_properties/Action.java @@ -0,0 +1,14 @@ +package inf112.fiasko.roborally.element_properties; + +/** + * This enum represents an action on a programming card + */ +public enum Action { + ROTATE_RIGHT, + ROTATE_LEFT, + U_TURN, + MOVE_1, + MOVE_2, + MOVE_3, + BACK_UP +} \ No newline at end of file diff --git a/src/main/java/inf112/fiasko/roborally/objects/ICardWithoutSuit.java b/src/main/java/inf112/fiasko/roborally/objects/ICardWithoutSuit.java new file mode 100644 index 0000000..b146361 --- /dev/null +++ b/src/main/java/inf112/fiasko/roborally/objects/ICardWithoutSuit.java @@ -0,0 +1,20 @@ +package inf112.fiasko.roborally.objects; + +/** + * This Interface describes a card without a card suit + * @param The value type + * @param The symbol type + */ +public interface ICardWithoutSuit { + /** + * Gets the value of the card + * @return The card value + */ + S getValue(); + + /** + * Gets the symbol of the card + * @return The card symbol + */ + T getSymbol(); +}