mirror of
https://github.com/inf112-v20/Fiasko.git
synced 2025-01-31 23:29:36 +01:00
Forenkler jobben til skjermer som implementerer InteractiveScreen
InteractiveScreen legger seg selv til input multiplekseren
This commit is contained in:
parent
4e44d44be7
commit
4b9eadc9f2
@ -55,7 +55,6 @@ public class BoardActiveScreen extends InteractiveScreen {
|
|||||||
@Override
|
@Override
|
||||||
public void show() {
|
public void show() {
|
||||||
super.show();
|
super.show();
|
||||||
inputMultiplexer.addProcessor(this);
|
|
||||||
resetCamera();
|
resetCamera();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,8 +58,6 @@ public class CardChoiceScreen extends InteractiveScreen implements Screen {
|
|||||||
shapeRenderer = new ShapeRenderer();
|
shapeRenderer = new ShapeRenderer();
|
||||||
shapeRenderer.setAutoShapeType(true);
|
shapeRenderer.setAutoShapeType(true);
|
||||||
|
|
||||||
inputMultiplexer = new InputMultiplexer();
|
|
||||||
|
|
||||||
generateCards(deck);
|
generateCards(deck);
|
||||||
this.chosenCards = new ArrayList<>();
|
this.chosenCards = new ArrayList<>();
|
||||||
|
|
||||||
@ -70,8 +68,6 @@ public class CardChoiceScreen extends InteractiveScreen implements Screen {
|
|||||||
|
|
||||||
confirmCards.addListener(getConfirmListener());
|
confirmCards.addListener(getConfirmListener());
|
||||||
stage.setViewport(viewport);
|
stage.setViewport(viewport);
|
||||||
inputMultiplexer.addProcessor(this);
|
|
||||||
inputMultiplexer.addProcessor(stage);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -144,7 +140,6 @@ public class CardChoiceScreen extends InteractiveScreen implements Screen {
|
|||||||
@Override
|
@Override
|
||||||
public void show() {
|
public void show() {
|
||||||
super.show();
|
super.show();
|
||||||
Gdx.input.setInputProcessor(inputMultiplexer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -6,6 +6,12 @@ import com.badlogic.gdx.InputProcessor;
|
|||||||
* This class overrides all InputProcessor methods to make cleaner abstract screens with input processors
|
* This class overrides all InputProcessor methods to make cleaner abstract screens with input processors
|
||||||
*/
|
*/
|
||||||
public abstract class InteractiveScreen extends AbstractScreen implements InputProcessor {
|
public abstract class InteractiveScreen extends AbstractScreen implements InputProcessor {
|
||||||
|
@Override
|
||||||
|
public void show() {
|
||||||
|
super.show();
|
||||||
|
inputMultiplexer.addProcessor(this);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean keyDown(int i) {
|
public boolean keyDown(int i) {
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user