handleSdlEvent method

  1. @override
void handleSdlEvent(
  1. Event event
)
override

Handle an SDL event.

This method will be called only if the event in question is not consumed by game.

Implementation

@override
void handleSdlEvent(final Event event) {
  if (event is ControllerAxisEvent) {
    axisDispatcher.handleAxisValue(event.axis, event.smallValue);
  } else if (event is KeyboardEvent &&
      event.repeat == false &&
      event.key.modifiers.isEmpty &&
      event.state == PressedState.pressed) {
    final scanCode = event.key.scancode;
    if (scanCode == upScanCode) {
      up();
    } else if (scanCode == downScanCode) {
      down();
    } else if (scanCode == leftScanCode) {
      left();
    } else if (scanCode == rightScanCode) {
      right();
    } else if (scanCode == activateScanCode) {
      activate();
    } else if (scanCode == cancelScanCode) {
      cancel();
    } else {
      super.handleSdlEvent(event);
    }
  } else {
    super.handleSdlEvent(event);
  }
}