-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added ska sdl file to simplify sdl event loop.
- Loading branch information
Showing
4 changed files
with
52 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#include "ska_sdl.h" | ||
|
||
#include <SDL3/SDL.h> | ||
|
||
#if SKA_INPUT | ||
#include "input/sdl_input.h" | ||
#endif | ||
|
||
#if SKA_RENDERING | ||
#include "rendering/renderer.h" | ||
#endif | ||
|
||
bool ska_sdl_update() { | ||
bool shouldQuit = false; | ||
SDL_Event event; | ||
while (SDL_PollEvent(&event)) { | ||
switch(event.type) { | ||
case SDL_EVENT_QUIT: { | ||
shouldQuit = true; | ||
break; | ||
} | ||
case SDL_EVENT_WINDOW_RESIZED: { | ||
#if SKA_RENDERING | ||
const Sint32 windowWidth = event.window.data1; | ||
const Sint32 windowHeight = event.window.data2; | ||
ska_renderer_update_window_size(windowWidth, windowHeight); | ||
#endif | ||
break; | ||
} | ||
default: { | ||
#if SKA_INPUT | ||
ska_sdl_process_event(event); | ||
#endif | ||
break; | ||
} | ||
} | ||
} | ||
#if SKA_INPUT | ||
ska_sdl_process_axis_events(); | ||
#endif | ||
return shouldQuit; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#pragma once | ||
|
||
#include "seika/defines.h" | ||
|
||
bool ska_sdl_update(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters