Mercurial > repos > blastem
diff render_sdl.c @ 1476:0646ae0987c3 nuklear_ui
Fix UI rendering in fullscreen and wome initial work on the "pause" menu
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Wed, 22 Nov 2017 10:54:27 -0800 |
parents | c5c022c7aa54 |
children | 2d203bf73dbd |
line wrap: on
line diff
--- a/render_sdl.c Tue Nov 21 23:11:11 2017 -0800 +++ b/render_sdl.c Wed Nov 22 10:54:27 2017 -0800 @@ -696,7 +696,7 @@ { #ifndef DISABLE_OPENGL if (render_gl) { - glClearColor(0.0f, 0.0f, 0.0f, 1.0f); + glClearColor(1.0f, 0.0f, 0.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT); glUseProgram(program); @@ -997,6 +997,13 @@ drag_drop_handler = handler; } +static ui_render_fun on_context_destroyed, on_context_created; +void render_set_gl_context_handlers(ui_render_fun destroy, ui_render_fun create) +{ + on_context_destroyed = destroy; + on_context_created = create; +} + static event_handler custom_event_handler; void render_set_event_handler(event_handler handler) { @@ -1070,9 +1077,15 @@ update_aspect(); #ifndef DISABLE_OPENGL if (render_gl) { + if (on_context_destroyed) { + on_context_destroyed(); + } SDL_GL_DeleteContext(main_context); main_context = SDL_GL_CreateContext(main_window); gl_setup(); + if (on_context_created) { + on_context_created(); + } } #endif break;