diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-12-14 12:12:17 +0100 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-12-14 12:12:17 +0100 |
commit | 98828008e9e1e3b94f1f882b266ef5d5c2180b9f (patch) | |
tree | ef6d11fb99c99f9f7ded2ce290ef65a8b5a60389 /src/crepe | |
parent | 721262b488bcb67d5f19583c4a523d6ad1b54354 (diff) |
uhhhhh
Diffstat (limited to 'src/crepe')
-rw-r--r-- | src/crepe/facade/SDLContext.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/crepe/facade/SDLContext.cpp b/src/crepe/facade/SDLContext.cpp index 8353cef..c46e0d0 100644 --- a/src/crepe/facade/SDLContext.cpp +++ b/src/crepe/facade/SDLContext.cpp @@ -284,8 +284,8 @@ void SDLContext::update_camera_view(const Camera & cam, const vec2 & new_pos) { // resize window int w, h; SDL_GetWindowSize(this->game_window.get(), &w, &h); - if (w != config.window_settings.default_size.x || h != config.window_settings.default_size.y) { - SDL_SetWindowSize(this->game_window.get(), config.window_settings.default_size.x, config.window_settings.default_size.y); + if (w != config.window.size.x || h != config.window.size.y) { + SDL_SetWindowSize(this->game_window.get(), config.window.size.x, config.window.size.y); } vec2 & zoomed_viewport = this->cam_aux_data.zoomed_viewport; @@ -294,28 +294,28 @@ void SDLContext::update_camera_view(const Camera & cam, const vec2 & new_pos) { this->cam_aux_data.cam_pos = new_pos; zoomed_viewport = cam.viewport_size * cam_data.zoom; - float screen_aspect = static_cast<float>(config.window_settings.default_size.x) / config.window_settings.default_size.y; + float screen_aspect = static_cast<float>(config.window.size.x) / config.window.size.y; float viewport_aspect = zoomed_viewport.x / zoomed_viewport.y; // calculate black bars if (screen_aspect > viewport_aspect) { // pillarboxing - float scale = config.window_settings.default_size.y / zoomed_viewport.y; + float scale = config.window.size.y / zoomed_viewport.y; float adj_width = zoomed_viewport.x * scale; - float bar_width = (config.window_settings.default_size.x - adj_width) / 2; - this->black_bars[0] = {0, 0, bar_width, (float) config.window_settings.default_size.y}; - this->black_bars[1] = {(config.window_settings.default_size.x - bar_width), 0, bar_width, (float) config.window_settings.default_size.y}; + float bar_width = (config.window.size.x - adj_width) / 2; + this->black_bars[0] = {0, 0, bar_width, (float) config.window.size.y}; + this->black_bars[1] = {(config.window.size.x - bar_width), 0, bar_width, (float) config.window.size.y}; bar_size = {bar_width, 0}; render_scale.x = render_scale.y = scale; } else { // letterboxing - float scale = config.window_settings.default_size.x / (cam.viewport_size.x * cam_data.zoom); + float scale = config.window.size.x / (cam.viewport_size.x * cam_data.zoom); float adj_height = cam.viewport_size.y * scale; - float bar_height = (config.window_settings.default_size.y - adj_height) / 2; - this->black_bars[0] = {0, 0, (float) config.window_settings.default_size.x, bar_height}; + float bar_height = (config.window.size.y - adj_height) / 2; + this->black_bars[0] = {0, 0, (float) config.window.size.x, bar_height}; this->black_bars[1] - = {0, (config.window_settings.default_size.y - bar_height), (float) config.window_settings.default_size.x, bar_height}; + = {0, (config.window.size.y - bar_height), (float) config.window.size.x, bar_height}; bar_size = {0, bar_height}; render_scale.x = render_scale.y = scale; @@ -327,8 +327,8 @@ void SDLContext::update_camera_view(const Camera & cam, const vec2 & new_pos) { SDL_Rect bg = { .x = 0, .y = 0, - .w = config.window_settings.default_size.x, - .h = config.window_settings.default_size.y, + .w = config.window.size.x, + .h = config.window.size.y, }; // fill bg color |