use of net.catacombsnatch.game.event.input.events.KeyPressedEvent in project Catacomb-Snatch by Catacomb-Snatch.
the class InputManager method keyDown.
/* -------- Keyboard and Mouse input events -------- */
@Override
public boolean keyDown(int keycode) {
Scene scene = SceneManager.getCurrent();
if (scene != null)
scene.keyDown(keycode);
InputSource source = InputSource.KEYBOARD;
Key key = getKeyForSource(source, keycode, null);
pressed.put(key, true);
KeyPressedEvent event = new KeyPressedEvent(source, key, null);
EventManager.callEvent(event);
return true;
}
use of net.catacombsnatch.game.event.input.events.KeyPressedEvent in project Catacomb-Snatch by Catacomb-Snatch.
the class InputManager method buttonDown.
@Override
public boolean buttonDown(Controller controller, int button) {
Gdx.app.log(TAG, "Controller: " + controller + " Button: " + button);
InputSource source = InputSource.CONTROLLER;
Key key = getKeyForSource(source, button, controller);
pressed.put(key, true);
KeyPressedEvent event = new KeyPressedEvent(source, key, controller);
EventManager.callEvent(event);
return true;
}
use of net.catacombsnatch.game.event.input.events.KeyPressedEvent in project Catacomb-Snatch by Catacomb-Snatch.
the class InputManager method povMoved.
@Override
public boolean povMoved(Controller controller, int povCode, PovDirection value) {
Gdx.app.log(TAG, "Controller: " + controller.getName() + " povCode: " + povCode + " Value: " + value);
InputSource source = InputSource.CONTROLLER;
this.axisMoved(controller, 5, controller.getAxis(5));
this.axisMoved(controller, 6, controller.getAxis(6));
Gdx.app.log(TAG, "Controller: " + controller.getName() + " Axis5 Value: " + controller.getAxis(5));
Gdx.app.log(TAG, "Controller: " + controller.getName() + " Axis6 Value: " + controller.getAxis(6));
if (value == PovDirection.south) {
Key key = Key.MOVE_DOWN;
pressed.put(key, true);
KeyPressedEvent event = new KeyPressedEvent(source, key, controller);
EventManager.callEvent(event);
lastKey = key;
} else if (value == PovDirection.north) {
Key key = Key.MOVE_UP;
pressed.put(key, true);
KeyPressedEvent event = new KeyPressedEvent(source, key, controller);
EventManager.callEvent(event);
lastKey = key;
} else if (value == PovDirection.west) {
Key key = Key.MOVE_LEFT;
pressed.put(key, true);
KeyPressedEvent event = new KeyPressedEvent(source, key, controller);
EventManager.callEvent(event);
lastKey = key;
} else if (value == PovDirection.east) {
Key key = Key.MOVE_RIGHT;
pressed.put(key, true);
KeyPressedEvent event = new KeyPressedEvent(source, key, controller);
EventManager.callEvent(event);
lastKey = key;
} else {
if (lastKey != Key.UNKNOWN) {
pressed.put(lastKey, false);
KeyReleaseEvent event = new KeyReleaseEvent(source, lastKey, controller);
EventManager.callEvent(event);
}
}
// TODO
return true;
}
Aggregations