src/window.c

changeset 101
febf3dc10011
parent 100
5231da78831e
equal deleted inserted replaced
100:5231da78831e 101:febf3dc10011
78 if (asc_gl_context_initialize(&window->glctx, window->window, &settings->glsettings)) { 78 if (asc_gl_context_initialize(&window->glctx, window->window, &settings->glsettings)) {
79 asc_scene_init(&window->ui, (AscCameraParams){ 79 asc_scene_init(&window->ui, (AscCameraParams){
80 .type = ASC_CAMERA_ORTHO, 80 .type = ASC_CAMERA_ORTHO,
81 .ortho.rect = (asc_recti){ 81 .ortho.rect = (asc_recti){
82 0, 0, window->dimensions.width, window->dimensions.height 82 0, 0, window->dimensions.width, window->dimensions.height
83 } 83 },
84 .projection_update_func = asc_camera_ortho_update_size
84 }); 85 });
85 asc_dprintf("Window %u initialized at index %u", window->id, index); 86 asc_dprintf("Window %u initialized at index %u", window->id, index);
86 asc_context.active_window = index; 87 asc_context.active_window = index;
87 } else { 88 } else {
88 asc_error("Creating GL context failed for window %u at index %u", window->id, index); 89 asc_error("Creating GL context failed for window %u at index %u", window->id, index);
155 156
156 // Draw all scenes 157 // Draw all scenes
157 for (unsigned int i = 0; i < ASC_MAX_SCENES; i++) { 158 for (unsigned int i = 0; i < ASC_MAX_SCENES; i++) {
158 asc_scene_draw(&window->scenes[i]); 159 asc_scene_draw(&window->scenes[i]);
159 } 160 }
160 asc_camera_ortho_update_size(&window->ui.camera, (asc_vec2i){window_width, window_height});
161 asc_scene_draw(&window->ui); 161 asc_scene_draw(&window->ui);
162 162
163 // Swap Buffers 163 // Swap Buffers
164 SDL_GL_SwapWindow(window->window); 164 SDL_GL_SwapWindow(window->window);
165 165

mercurial