src/core.c

changeset 3
1efd6da2ad53
parent 2
bb2bfff31f1d
child 6
302971e8599b
--- a/src/core.c	Mon Oct 30 17:59:37 2023 +0100
+++ b/src/core.c	Mon Oct 30 18:09:27 2023 +0100
@@ -142,8 +142,8 @@
     CxIterator iter = cxListIterator(asc_context.windows);
     cx_foreach(AscWindow*, w, iter) {
         if (w->id == id) {
-            w->width = width;
-            w->height = height;
+            w->dimensions.width = width;
+            w->dimensions.height = height;
             return;
         }
     }
@@ -186,8 +186,8 @@
 void asc_window_settings_init_defaults(AscWindowSettings* settings) {
     settings->depth_size = 24;
     settings->vsync = 1;
-    settings->width = 800;
-    settings->height = 600;
+    settings->dimensions.width = 800;
+    settings->dimensions.height = 600;
     settings->fullscreen = 0;
     settings->gl_major_version = 3;
     settings->gl_minor_version = 3;
@@ -202,8 +202,8 @@
             settings->title,
             SDL_WINDOWPOS_CENTERED,
             SDL_WINDOWPOS_CENTERED,
-            settings->width,
-            settings->height,
+            settings->dimensions.width,
+            settings->dimensions.height,
             flags
     );
     if (window->window == NULL) {
@@ -212,7 +212,10 @@
     }
 
     window->id = SDL_GetWindowID(window->window);
-    SDL_GetWindowSize(window->window, &window->width, &window->height);
+    SDL_GetWindowSize(window->window,
+            &window->dimensions.width,
+            &window->dimensions.height
+    );
 
     SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
     SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, settings->gl_major_version);
@@ -280,7 +283,7 @@
 void asc_window_sync(AscWindow const* window) {
     SDL_GL_MakeCurrent(window->window, window->glctx);
     SDL_GL_SwapWindow(window->window);
-    glViewport(0, 0, window->width, window->height);
+    glViewport(0, 0, window->dimensions.width, window->dimensions.height);
     glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 }

mercurial