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

Function Window_ProcessEvents

src/Window_SDL2.c:302–337  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

300}
301
302void Window_ProcessEvents(float delta) {
303 SDL_Event e;
304 while (SDL_PollEvent(&e)) {
305 switch (e.type) {
306
307 case SDL_KEYDOWN:
308 case SDL_KEYUP:
309 OnKeyEvent(&e); break;
310 case SDL_MOUSEBUTTONDOWN:
311 case SDL_MOUSEBUTTONUP:
312 OnMouseEvent(&e); break;
313 case SDL_MOUSEWHEEL:
314 Mouse_ScrollHWheel(e.wheel.x);
315 Mouse_ScrollVWheel(e.wheel.y);
316 break;
317 case SDL_MOUSEMOTION:
318 Pointer_SetPosition(0, e.motion.x, e.motion.y);
319 if (Input.RawMode) Event_RaiseRawMove(&PointerEvents.RawMoved, e.motion.xrel, e.motion.yrel);
320 break;
321 case SDL_TEXTINPUT:
322 OnTextEvent(&e); break;
323 case SDL_WINDOWEVENT:
324 OnWindowEvent(&e); break;
325
326 case SDL_QUIT:
327 Window_Main.Exists = false;
328 Event_RaiseVoid(&WindowEvents.Closing);
329 break;
330
331 case SDL_RENDER_DEVICE_RESET:
332 Gfx_LoseContext("SDL device reset event");
333 Gfx_RecreateContext();
334 break;
335 }
336 }
337}
338
339static void Cursor_GetRawPos(int* x, int* y) {
340 SDL_GetMouseState(x, y);

Callers

nothing calls this directly

Calls 11

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

Tested by

no test coverage detected