v0.8.0: refactored GameAction classes to more closely resemble enums

This commit is contained in:
Evan Debenham
2019-12-16 22:39:39 -05:00
parent 6dc0235aa6
commit 93320fb676
17 changed files with 186 additions and 204 deletions
@@ -35,13 +35,12 @@ public class Scene extends Group {
@Override
public boolean onSignal( KeyEvent event ) {
if (Game.instance != null && event.pressed) {
switch (KeyBindings.getBinding( event )) {
case GameAction.BACK:
onBackPressed();
break;
case GameAction.MENU:
onMenuPressed();
break;
if (KeyBindings.getActionForKey( event ) == GameAction.BACK){
onBackPressed();
} else if (KeyBindings.getActionForKey( event ) == GameAction.MENU){
onMenuPressed();
}
}
return false;
@@ -67,7 +67,7 @@ public class Button extends Component {
@Override
public boolean onSignal ( KeyEvent event ) {
if ( active && !event.pressed
&& KeyBindings.getBinding( event ) == keyAction()){
&& KeyBindings.getActionForKey( event ) == keyAction()){
onClick();
return true;
}
@@ -78,7 +78,7 @@ public class Button extends Component {
private Signal.Listener<KeyEvent> keyListener;
public int keyAction(){
public GameAction keyAction(){
return GameAction.NONE;
}