From 4b9eadc9f2c221efa0a5533a73efe2c1064b4c7c Mon Sep 17 00:00:00 2001 From: EpicKnarvik97 Date: Fri, 24 Apr 2020 22:41:23 +0200 Subject: [PATCH] Forenkler jobben til skjermer som implementerer InteractiveScreen InteractiveScreen legger seg selv til input multiplekseren --- .../roborally/gamewrapper/screens/BoardActiveScreen.java | 1 - .../roborally/gamewrapper/screens/CardChoiceScreen.java | 5 ----- .../roborally/gamewrapper/screens/InteractiveScreen.java | 6 ++++++ 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/inf112/fiasko/roborally/gamewrapper/screens/BoardActiveScreen.java b/src/main/java/inf112/fiasko/roborally/gamewrapper/screens/BoardActiveScreen.java index 01ae484..c9a8fe0 100644 --- a/src/main/java/inf112/fiasko/roborally/gamewrapper/screens/BoardActiveScreen.java +++ b/src/main/java/inf112/fiasko/roborally/gamewrapper/screens/BoardActiveScreen.java @@ -55,7 +55,6 @@ public class BoardActiveScreen extends InteractiveScreen { @Override public void show() { super.show(); - inputMultiplexer.addProcessor(this); resetCamera(); } diff --git a/src/main/java/inf112/fiasko/roborally/gamewrapper/screens/CardChoiceScreen.java b/src/main/java/inf112/fiasko/roborally/gamewrapper/screens/CardChoiceScreen.java index f212d36..9379411 100644 --- a/src/main/java/inf112/fiasko/roborally/gamewrapper/screens/CardChoiceScreen.java +++ b/src/main/java/inf112/fiasko/roborally/gamewrapper/screens/CardChoiceScreen.java @@ -58,8 +58,6 @@ public class CardChoiceScreen extends InteractiveScreen implements Screen { shapeRenderer = new ShapeRenderer(); shapeRenderer.setAutoShapeType(true); - inputMultiplexer = new InputMultiplexer(); - generateCards(deck); this.chosenCards = new ArrayList<>(); @@ -70,8 +68,6 @@ public class CardChoiceScreen extends InteractiveScreen implements Screen { confirmCards.addListener(getConfirmListener()); stage.setViewport(viewport); - inputMultiplexer.addProcessor(this); - inputMultiplexer.addProcessor(stage); } /** @@ -144,7 +140,6 @@ public class CardChoiceScreen extends InteractiveScreen implements Screen { @Override public void show() { super.show(); - Gdx.input.setInputProcessor(inputMultiplexer); } @Override diff --git a/src/main/java/inf112/fiasko/roborally/gamewrapper/screens/InteractiveScreen.java b/src/main/java/inf112/fiasko/roborally/gamewrapper/screens/InteractiveScreen.java index f26fe56..518bbc6 100644 --- a/src/main/java/inf112/fiasko/roborally/gamewrapper/screens/InteractiveScreen.java +++ b/src/main/java/inf112/fiasko/roborally/gamewrapper/screens/InteractiveScreen.java @@ -6,6 +6,12 @@ import com.badlogic.gdx.InputProcessor; * This class overrides all InputProcessor methods to make cleaner abstract screens with input processors */ public abstract class InteractiveScreen extends AbstractScreen implements InputProcessor { + @Override + public void show() { + super.show(); + inputMultiplexer.addProcessor(this); + } + @Override public boolean keyDown(int i) { return false;