Changeset d8cf709 in opengl-game for game-gui-sdl.cpp
- Timestamp:
- Feb 13, 2021, 11:41:39 PM (4 years ago)
- Branches:
- feature/imgui-sdl
- Children:
- c6f0793
- Parents:
- 8b823e7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
game-gui-sdl.cpp
r8b823e7 rd8cf709 79 79 } 80 80 81 int GameGui_SDL::pollEvent(UIEvent* event) {81 int GameGui_SDL::pollEvent(UIEvent* uiEvent) { 82 82 SDL_Event e; 83 83 … … 87 87 88 88 if (SDL_PollEvent(&e)) { 89 uiEvent->rawEvent.sdl = e; 90 91 GameEvent* event = &uiEvent->event; 92 89 93 switch(e.type) { 90 94 case SDL_QUIT: … … 93 97 case SDL_WINDOWEVENT: 94 98 if (e.window.event == SDL_WINDOWEVENT_SIZE_CHANGED || 95 e.window.event == SDL_WINDOWEVENT_MINIMIZED ||96 e.window.event == SDL_WINDOWEVENT_MAXIMIZED) {99 e.window.event == SDL_WINDOWEVENT_MINIMIZED || 100 e.window.event == SDL_WINDOWEVENT_MAXIMIZED) { 97 101 event->type = UI_EVENT_WINDOWRESIZE; 102 } else if (e.window.event == SDL_WINDOWEVENT_CLOSE && 103 e.window.windowID == SDL_GetWindowID(window)) { 104 event->type = UI_EVENT_QUIT; 98 105 } else { 99 106 event->type = UI_EVENT_WINDOW; … … 122 129 event->mouse.y = e.motion.y; 123 130 case SDL_FINGERMOTION: 131 // TODO: Get coordinates for finger events 124 132 event->type = UI_EVENT_MOUSEMOTION; 125 133 break; 126 // Ignore the following events134 // The following events are not currently supported 127 135 case SDL_AUDIODEVICEADDED: 128 136 case SDL_AUDIODEVICEREMOVED: 129 137 case SDL_TEXTINPUT: 130 138 case SDL_TEXTEDITING: 139 case SDL_MOUSEWHEEL: 131 140 event->type = UI_EVENT_UNKNOWN; 132 event->unknown.eventType = e.type;133 141 break; 134 142 default: 135 143 event->type = UI_EVENT_UNKNOWN; 136 event->unknown.eventType = 0;137 144 } 138 145 139 146 return 1; 147 } else { 148 return 0; 140 149 } 141 142 event = nullptr;143 return 0;144 150 } 145 151
Note:
See TracChangeset
for help on using the changeset viewer.