comparison 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
comparison
equal deleted inserted replaced
1475:afa3fbb76bff 1476:0646ae0987c3
694 694
695 void render_update_display() 695 void render_update_display()
696 { 696 {
697 #ifndef DISABLE_OPENGL 697 #ifndef DISABLE_OPENGL
698 if (render_gl) { 698 if (render_gl) {
699 glClearColor(0.0f, 0.0f, 0.0f, 1.0f); 699 glClearColor(1.0f, 0.0f, 0.0f, 1.0f);
700 glClear(GL_COLOR_BUFFER_BIT); 700 glClear(GL_COLOR_BUFFER_BIT);
701 701
702 glUseProgram(program); 702 glUseProgram(program);
703 glActiveTexture(GL_TEXTURE0); 703 glActiveTexture(GL_TEXTURE0);
704 glBindTexture(GL_TEXTURE_2D, textures[0]); 704 glBindTexture(GL_TEXTURE_2D, textures[0]);
995 void render_set_drag_drop_handler(drop_handler handler) 995 void render_set_drag_drop_handler(drop_handler handler)
996 { 996 {
997 drag_drop_handler = handler; 997 drag_drop_handler = handler;
998 } 998 }
999 999
1000 static ui_render_fun on_context_destroyed, on_context_created;
1001 void render_set_gl_context_handlers(ui_render_fun destroy, ui_render_fun create)
1002 {
1003 on_context_destroyed = destroy;
1004 on_context_created = create;
1005 }
1006
1000 static event_handler custom_event_handler; 1007 static event_handler custom_event_handler;
1001 void render_set_event_handler(event_handler handler) 1008 void render_set_event_handler(event_handler handler)
1002 { 1009 {
1003 custom_event_handler = handler; 1010 custom_event_handler = handler;
1004 } 1011 }
1068 main_width = event->window.data1; 1075 main_width = event->window.data1;
1069 main_height = event->window.data2; 1076 main_height = event->window.data2;
1070 update_aspect(); 1077 update_aspect();
1071 #ifndef DISABLE_OPENGL 1078 #ifndef DISABLE_OPENGL
1072 if (render_gl) { 1079 if (render_gl) {
1080 if (on_context_destroyed) {
1081 on_context_destroyed();
1082 }
1073 SDL_GL_DeleteContext(main_context); 1083 SDL_GL_DeleteContext(main_context);
1074 main_context = SDL_GL_CreateContext(main_window); 1084 main_context = SDL_GL_CreateContext(main_window);
1075 gl_setup(); 1085 gl_setup();
1086 if (on_context_created) {
1087 on_context_created();
1088 }
1076 } 1089 }
1077 #endif 1090 #endif
1078 break; 1091 break;
1079 } 1092 }
1080 break; 1093 break;