v0.8.0: added basic key action and key mapping support

This commit is contained in:
Evan Debenham
2019-10-28 21:06:02 -04:00
parent 4f430015c3
commit df3a0a010b
8 changed files with 136 additions and 35 deletions
@@ -99,10 +99,7 @@ public class Game implements ApplicationListener {
Blending.useDefault();
inputHandler = new InputHandler();
Gdx.input.setInputProcessor(inputHandler);
Gdx.input.setCatchKey(KeyEvent.BACK, true);
Gdx.input.setCatchKey(KeyEvent.MENU, true);
inputHandler = new InputHandler( Gdx.input );
//refreshes texture and vertex data stored on the gpu
TextureCache.reload();
@@ -21,6 +21,7 @@
package com.watabou.noosa;
import com.watabou.input.KeyBindings;
import com.watabou.input.KeyEvent;
import com.watabou.utils.Signal;
@@ -33,13 +34,13 @@ public class Scene extends Group {
@Override
public boolean onSignal( KeyEvent event ) {
if (Game.instance != null && event.pressed) {
switch (event.code) {
case KeyEvent.BACK:
onBackPressed();
break;
case KeyEvent.MENU:
onMenuPressed();
break;
switch (KeyBindings.getBinding( event )) {
case BACK:
onBackPressed();
break;
case MENU:
onMenuPressed();
break;
}
}
return false;