From 151c58ff7b899c6bbf9ec4b615f3b8c513ac7437 Mon Sep 17 00:00:00 2001 From: Sara Gerretsen Date: Thu, 4 Sep 2025 20:17:39 +0200 Subject: [PATCH] feat: added sf::VideoMode to AppConfig, optimized window initialisation --- src/defs.h | 2 ++ src/main.cpp | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/defs.h b/src/defs.h index be8d88a..f2552c1 100644 --- a/src/defs.h +++ b/src/defs.h @@ -3,9 +3,11 @@ #include #include +#include struct AppConfig { sf::String window_title{ "UNNAMED WINDOW" }; + sf::VideoMode mode{{ 1280, 720 }}; bool vsync{}; std::optional frame_rate_limit{std::nullopt}; }; diff --git a/src/main.cpp b/src/main.cpp index ffefd2e..a0b02d8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -9,13 +9,12 @@ static sf::Clock deltaClock{}; extern void configure(AppConfig &config); void initialize_window() { - window.create(sf::VideoMode({ 1280, 720 }),"UNNAMED WINDOW"); AppConfig cfg{}; configure(cfg); + window.create(cfg.mode, cfg.window_title); if (cfg.frame_rate_limit) window.setFramerateLimit(cfg.frame_rate_limit.value_or(0)); window.setVerticalSyncEnabled(cfg.vsync); - window.setTitle(cfg.window_title); } void initialize_imgui() {