MCPcopy Create free account
hub / github.com/ClassiCube/ClassiCube / Window_ProcessEvents

Function Window_ProcessEvents

src/Window_SDL3.c:264–325  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

262static void ProcessDialogEvent(SDL_Event* e);
263
264void Window_ProcessEvents(float delta) {
265 SDL_Event e;
266 while (SDL_PollEvent(&e)) {
267 switch (e.type) {
268
269 case SDL_EVENT_KEY_DOWN:
270 case SDL_EVENT_KEY_UP:
271 OnKeyEvent(&e); break;
272 case SDL_EVENT_MOUSE_BUTTON_DOWN:
273 case SDL_EVENT_MOUSE_BUTTON_UP:
274 OnMouseEvent(&e); break;
275 case SDL_EVENT_MOUSE_WHEEL:
276 Mouse_ScrollHWheel(e.wheel.x);
277 Mouse_ScrollVWheel(e.wheel.y);
278 break;
279 case SDL_EVENT_MOUSE_MOTION:
280 Pointer_SetPosition(0, e.motion.x, e.motion.y);
281 if (Input.RawMode) Event_RaiseRawMove(&PointerEvents.RawMoved, e.motion.xrel, e.motion.yrel);
282 break;
283 case SDL_EVENT_TEXT_INPUT:
284 OnTextEvent(&e); break;
285
286 case SDL_EVENT_QUIT:
287 Window_Main.Exists = false;
288 Event_RaiseVoid(&WindowEvents.Closing);
289 break;
290
291 case SDL_EVENT_RENDER_DEVICE_RESET:
292 Gfx_LoseContext("SDL device reset event");
293 Gfx_RecreateContext();
294 break;
295
296
297 case SDL_EVENT_WINDOW_EXPOSED:
298 Event_RaiseVoid(&WindowEvents.RedrawNeeded);
299 break;
300 case SDL_EVENT_WINDOW_RESIZED: // TODO SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED
301 RefreshWindowBounds();
302 Event_RaiseVoid(&WindowEvents.Resized);
303 break;
304 case SDL_EVENT_WINDOW_MINIMIZED:
305 case SDL_EVENT_WINDOW_MAXIMIZED:
306 case SDL_EVENT_WINDOW_RESTORED:
307 Event_RaiseVoid(&WindowEvents.StateChanged);
308 break;
309 case SDL_EVENT_WINDOW_FOCUS_GAINED:
310 Window_Main.Focused = true;
311 Event_RaiseVoid(&WindowEvents.FocusChanged);
312 break;
313 case SDL_EVENT_WINDOW_FOCUS_LOST:
314 Window_Main.Focused = false;
315 Event_RaiseVoid(&WindowEvents.FocusChanged);
316 break;
317 case SDL_EVENT_WINDOW_CLOSE_REQUESTED:
318 Window_RequestClose();
319 break;
320 default:
321 if (e.type == dlg_event) ProcessDialogEvent(&e);

Callers

nothing calls this directly

Calls 13

Mouse_ScrollHWheelFunction · 0.85
Mouse_ScrollVWheelFunction · 0.85
Pointer_SetPositionFunction · 0.85
Event_RaiseRawMoveFunction · 0.85
Event_RaiseVoidFunction · 0.85
Gfx_LoseContextFunction · 0.85
Gfx_RecreateContextFunction · 0.85
ProcessDialogEventFunction · 0.85
OnKeyEventFunction · 0.70
OnMouseEventFunction · 0.70
OnTextEventFunction · 0.70
RefreshWindowBoundsFunction · 0.70

Tested by

no test coverage detected