67 asc_error("Creating Window failed: %s", SDL_GetError()); |
67 asc_error("Creating Window failed: %s", SDL_GetError()); |
68 return; |
68 return; |
69 } |
69 } |
70 |
70 |
71 window->id = SDL_GetWindowID(window->window); |
71 window->id = SDL_GetWindowID(window->window); |
72 SDL_GetWindowSize(window->window, |
72 { |
73 &window->dimensions.width, |
73 Sint32 w, h; |
74 &window->dimensions.height |
74 SDL_GetWindowSize(window->window, &w, &h); |
75 ); |
75 window->dimensions = asc_vec2u_new(w, h); |
|
76 } |
76 window->resized = true; // count initial sizing as resize |
77 window->resized = true; // count initial sizing as resize |
77 |
78 |
78 if (asc_gl_context_initialize(&window->glctx, window->window, &settings->glsettings)) { |
79 if (asc_gl_context_initialize(&window->glctx, window->window, &settings->glsettings)) { |
79 asc_scene_init(&window->ui, (AscCameraParams){ |
80 asc_scene_init(&window->ui, (AscCameraParams){ |
80 .type = ASC_CAMERA_ORTHO, |
81 .type = ASC_CAMERA_ORTHO, |
81 .ortho.rect = (asc_recti){ |
82 .ortho.rect = asc_recti_new(0, 0, window->dimensions.width, window->dimensions.height), |
82 0, 0, window->dimensions.width, window->dimensions.height |
|
83 }, |
|
84 .projection_update_func = asc_camera_ortho_update_size |
83 .projection_update_func = asc_camera_ortho_update_size |
85 }); |
84 }); |
86 asc_dprintf("Window %u initialized at index %u", window->id, index); |
85 asc_dprintf("Window %u initialized at index %u", window->id, index); |
87 asc_context.active_window = index; |
86 asc_context.active_window = index; |
88 } else { |
87 } else { |