toGameControllerDeviceState method

DeviceState toGameControllerDeviceState()

Convert to a game controller device state.

Implementation

DeviceState toGameControllerDeviceState() {
  switch (this) {
    case SDL_EventType.SDL_CONTROLLERDEVICEADDED:
      return DeviceState.added;
    case SDL_EventType.SDL_CONTROLLERDEVICEREMOVED:
      return DeviceState.removed;
    case SDL_EventType.SDL_CONTROLLERDEVICEREMAPPED:
      return DeviceState.remapped;
    default:
      throw SdlError(this, 'Invalid controller device state.');
  }
}