src/window.c

changeset 99
ac143db979dc
parent 96
9e25f080a33e
--- a/src/window.c	Sun Apr 27 13:27:27 2025 +0200
+++ b/src/window.c	Sun Apr 27 15:17:12 2025 +0200
@@ -77,6 +77,9 @@
 
     if (asc_gl_context_initialize(&window->glctx, window->window, &settings->glsettings)) {
         asc_scene_init(&window->ui);
+        asc_camera_ortho(&window->ui.camera, (asc_recti){
+            0, 0, window->dimensions.width, window->dimensions.height
+        });
         asc_dprintf("Window %u initialized at index %u", window->id, index);
         asc_context.active_window = index;
     } else {
@@ -149,12 +152,11 @@
     glClear(GL_COLOR_BUFFER_BIT);
 
     // Draw all scenes
-    asc_recti viewport = {0, 0, window_width, window_height};
     for (unsigned int i = 0; i < ASC_MAX_SCENES; i++) {
-        asc_scene_draw(&window->scenes[i], viewport);
+        asc_scene_draw(&window->scenes[i]);
     }
-    asc_camera_ortho(&window->ui.camera, viewport);
-    asc_scene_draw(&window->ui, viewport);
+    asc_camera_ortho_update_size(&window->ui.camera, (asc_vec2i){window_width, window_height});
+    asc_scene_draw(&window->ui);
 
     // Swap Buffers
     SDL_GL_SwapWindow(window->window);

mercurial