71 |
71 |
72 window->id = SDL_GetWindowID(window->window); |
72 window->id = SDL_GetWindowID(window->window); |
73 { |
73 { |
74 Sint32 w, h; |
74 Sint32 w, h; |
75 SDL_GetWindowSize(window->window, &w, &h); |
75 SDL_GetWindowSize(window->window, &w, &h); |
76 window->dimensions = asc_vec2u_new(w, h); |
76 window->dimensions = ASC_VEC2U(w, h); |
77 } |
77 } |
78 window->resized = true; // count initial sizing as resize |
78 window->resized = true; // count initial sizing as resize |
79 |
79 |
80 // default UI scale |
80 // default UI scale |
81 window->ui_scale = 1.0f; |
81 window->ui_scale = 1.0f; |
82 |
82 |
83 if (asc_gl_context_initialize(&window->glctx, window->window, &settings->glsettings)) { |
83 if (asc_gl_context_initialize(&window->glctx, window->window, &settings->glsettings)) { |
84 asc_scene_init(&window->ui, |
84 asc_scene_init(&window->ui, |
85 .type = ASC_CAMERA_ORTHO, |
85 .type = ASC_CAMERA_ORTHO, |
86 .ortho.rect = asc_recti_new(0, 0, window->dimensions.width, window->dimensions.height), |
86 .ortho.rect = ASC_RECTI(0, 0, window->dimensions.width, window->dimensions.height), |
87 .projection_update_func = asc_camera_ortho_update_size |
87 .projection_update_func = asc_camera_ortho_update_size |
88 ); |
88 ); |
89 asc_dprintf("Window %u initialized at index %u", window->id, index); |
89 asc_dprintf("Window %u initialized at index %u", window->id, index); |
90 asc_context.active_window = index; |
90 asc_context.active_window = index; |
91 } else { |
91 } else { |
204 const int display = SDL_GetWindowDisplayIndex(window->window); |
204 const int display = SDL_GetWindowDisplayIndex(window->window); |
205 if (SDL_GetDesktopDisplayMode(display, &dm)) { |
205 if (SDL_GetDesktopDisplayMode(display, &dm)) { |
206 asc_error("Failed to get display mode for window %u on display %d: %s", |
206 asc_error("Failed to get display mode for window %u on display %d: %s", |
207 window->id, display, SDL_GetError()); |
207 window->id, display, SDL_GetError()); |
208 } |
208 } |
209 return asc_vec2u_new(dm.w, dm.h); |
209 return ASC_VEC2U(dm.w, dm.h); |
210 } |
210 } |