264 memset(window, 0, sizeof(AscWindow)); |
264 memset(window, 0, sizeof(AscWindow)); |
265 } |
265 } |
266 |
266 |
267 void asc_window_destroy(AscWindow* window) { |
267 void asc_window_destroy(AscWindow* window) { |
268 // find the window in the context and remove it |
268 // find the window in the context and remove it |
|
269 bool found = false; |
269 CxMutIterator iter = cxListMutIterator(asc_context.windows); |
270 CxMutIterator iter = cxListMutIterator(asc_context.windows); |
270 cx_foreach(AscWindow*, w, iter) { |
271 cx_foreach(AscWindow*, w, iter) { |
271 if (w == window) { |
272 if (w == window) { |
272 asc_dprintf("Window %u removed from context.", window->id); |
273 found = true; |
273 cxIteratorFlagRemoval(iter); |
274 cxIteratorFlagRemoval(iter); |
274 } |
275 } |
275 } |
276 } |
276 asc_window_destroy_impl(window); |
277 if (!found) asc_window_destroy_impl(window); |
277 } |
278 } |
278 |
279 |
279 void asc_window_sync(AscWindow const* window) { |
280 void asc_window_sync(AscWindow const* window) { |
280 SDL_GL_MakeCurrent(window->window, window->glctx); |
281 SDL_GL_MakeCurrent(window->window, window->glctx); |
281 SDL_GL_SwapWindow(window->window); |
282 SDL_GL_SwapWindow(window->window); |