| 85 | bool validatePath(); |
| 86 | |
| 87 | void handleEvent(SDL_Event& Event) |
| 88 | { |
| 89 | TFE_Ui::setUiInput(&Event); |
| 90 | TFE_Settings_Window* windowSettings = TFE_Settings::getWindowSettings(); |
| 91 | |
| 92 | switch (Event.type) |
| 93 | { |
| 94 | case SDL_QUIT: |
| 95 | { |
| 96 | TFE_System::logWrite(LOG_MSG, "Main", "App Quit"); |
| 97 | s_loop = false; |
| 98 | } break; |
| 99 | case SDL_WINDOWEVENT: |
| 100 | { |
| 101 | if (Event.window.event == SDL_WINDOWEVENT_RESIZED || Event.window.event == SDL_WINDOWEVENT_SIZE_CHANGED) |
| 102 | { |
| 103 | TFE_RenderBackend::resize(Event.window.data1, Event.window.data2); |
| 104 | } |
| 105 | } break; |
| 106 | case SDL_CONTROLLERDEVICEADDED: |
| 107 | { |
| 108 | const s32 cIdx = Event.cdevice.which; |
| 109 | if (SDL_IsGameController(cIdx)) |
| 110 | { |
| 111 | SDL_GameController* controller = SDL_GameControllerOpen(cIdx); |
| 112 | SDL_Joystick* j = SDL_GameControllerGetJoystick(controller); |
| 113 | SDL_JoystickID joyId = SDL_JoystickInstanceID(j); |
| 114 | |
| 115 | //Save the joystick id to used in the future events |
| 116 | SDL_GameControllerOpen(0); |
| 117 | } |
| 118 | } break; |
| 119 | case SDL_MOUSEBUTTONDOWN: |
| 120 | { |
| 121 | TFE_Input::setMouseButtonDown(MouseButton(Event.button.button - SDL_BUTTON_LEFT)); |
| 122 | } break; |
| 123 | case SDL_MOUSEBUTTONUP: |
| 124 | { |
| 125 | TFE_Input::setMouseButtonUp(MouseButton(Event.button.button - SDL_BUTTON_LEFT)); |
| 126 | } break; |
| 127 | case SDL_MOUSEWHEEL: |
| 128 | { |
| 129 | TFE_Input::setMouseWheel(Event.wheel.x, Event.wheel.y); |
| 130 | } break; |
| 131 | case SDL_KEYDOWN: |
| 132 | { |
| 133 | if (Event.key.keysym.scancode) |
| 134 | { |
| 135 | TFE_Input::setKeyDown(KeyboardCode(Event.key.keysym.scancode), Event.key.repeat != 0); |
| 136 | } |
| 137 | |
| 138 | if (Event.key.keysym.scancode) |
| 139 | { |
| 140 | TFE_Input::setBufferedKey(KeyboardCode(Event.key.keysym.scancode)); |
| 141 | } |
| 142 | } break; |
| 143 | case SDL_KEYUP: |
| 144 | { |
no test coverage detected