src/window.c

changeset 73
cfa1d05754ac
parent 68
823c03733e42
child 75
0ce353485509
equal deleted inserted replaced
72:84472fb3adbd 73:cfa1d05754ac
54 asc_dprintf("Tried to create window with index %u twice", index); 54 asc_dprintf("Tried to create window with index %u twice", index);
55 return; 55 return;
56 } 56 }
57 if (window->ui != NULL) { 57 if (window->ui != NULL) {
58 asc_dprintf("Window with index %u has a dangling UI pointer", index); 58 asc_dprintf("Window with index %u has a dangling UI pointer", index);
59 asc_scene_node_free(window->ui); 59 asc_scene_destroy(window->ui);
60 } 60 }
61 61
62 Uint32 flags = SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN; 62 Uint32 flags = SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN;
63 flags |= settings->fullscreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : SDL_WINDOW_RESIZABLE; 63 flags |= settings->fullscreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : SDL_WINDOW_RESIZABLE;
64 64
81 &window->dimensions.height 81 &window->dimensions.height
82 ); 82 );
83 window->resized = true; // count initial sizing as resize 83 window->resized = true; // count initial sizing as resize
84 84
85 if (asc_gl_context_initialize(&window->glctx, window->window, &settings->glsettings)) { 85 if (asc_gl_context_initialize(&window->glctx, window->window, &settings->glsettings)) {
86 window->ui = asc_scene_node_empty(); 86 window->ui = asc_scene_create();
87 asc_dprintf("Window %u initialized", window->id); 87 asc_dprintf("Window %u initialized", window->id);
88 asc_context.active_window = index; 88 asc_context.active_window = index;
89 } else { 89 } else {
90 asc_dprintf("Creating GL context failed for window %u", window->id); 90 asc_dprintf("Creating GL context failed for window %u", window->id);
91 // cleanup on error 91 // cleanup on error
109 109
110 // for releasing OpenGL resources, we need to make the context current 110 // for releasing OpenGL resources, we need to make the context current
111 asc_gl_context_activate(&window->glctx); 111 asc_gl_context_activate(&window->glctx);
112 112
113 // destroy all scenes 113 // destroy all scenes
114 asc_scene_node_free(window->ui); 114 asc_scene_destroy(window->ui);
115 window->ui = NULL; 115 window->ui = NULL;
116 116
117 // release context related data 117 // release context related data
118 asc_gl_context_destroy(&window->glctx); 118 asc_gl_context_destroy(&window->glctx);
119 119

mercurial