aboutsummaryrefslogtreecommitdiff
path: root/src/saffron_window.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/saffron_window.c')
-rw-r--r--src/saffron_window.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/saffron_window.c b/src/saffron_window.c
index a909bc3..085ee20 100644
--- a/src/saffron_window.c
+++ b/src/saffron_window.c
@@ -1,3 +1,4 @@
+#include "saffron_api.h"
#include "saffron_theme.h"
#include <SDL3/SDL_render.h>
#include <SDL3/SDL_video.h>
@@ -74,6 +75,14 @@ static void handle_window_resized(SDL_Event* event, SaffronWindow* window) {
saffron_box_layout((SaffronBox*)window->root);
}
+void saffron_window_detach_gl_context(SaffronWindow *window) {
+ SDL_GL_MakeCurrent(window->sdl_window, NULL);
+}
+
+void saffron_window_reattach_gl_context(SaffronWindow *window) {
+ SDL_GL_MakeCurrent(window->sdl_window, window->gl_context);
+}
+
void saffron_window_main(SaffronWindow *window) {
if (!window) return;
@@ -104,7 +113,6 @@ void saffron_window_main(SaffronWindow *window) {
SDL_SetRenderDrawColor(window->renderer, 0, 0, 0, 255);
SDL_RenderClear(window->renderer);
- SDL_GL_MakeCurrent(window->sdl_window, window->gl_context); // just in case!
saffron_widget_draw(window->root, window->renderer);
SDL_RenderPresent(window->renderer);