feat: added sf::VideoMode to AppConfig, optimized window initialisation
This commit is contained in:
parent
574116fb09
commit
151c58ff7b
|
|
@ -3,9 +3,11 @@
|
|||
|
||||
#include <optional>
|
||||
#include <SFML/System/String.hpp>
|
||||
#include <SFML/Window/VideoMode.hpp>
|
||||
|
||||
struct AppConfig {
|
||||
sf::String window_title{ "UNNAMED WINDOW" };
|
||||
sf::VideoMode mode{{ 1280, 720 }};
|
||||
bool vsync{};
|
||||
std::optional<int> frame_rate_limit{std::nullopt};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue