diff --git a/res/yaml/window.yaml b/res/yaml/window.yaml new file mode 100644 index 0000000..d23163f --- /dev/null +++ b/res/yaml/window.yaml @@ -0,0 +1,4 @@ +resolution_width: 1024 +resolution_height: 768 +fullscreen: false +borderless: false \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index f56e74c..479390b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -17,12 +17,22 @@ */ int main(int argc, char* argv[]) { Yaml::setFolder("res/yaml/"); - Loader::i().setFolder("res/"); Loader::i().setSubFolder("textures/"); - tgui::Window window(sf::VideoMode(1024, 768, 32), "Dungeon Gunner", - sf::Style::Close | sf::Style::Titlebar); + Yaml windowConfig("window.yaml"); + sf::VideoMode mode(windowConfig.get("resolution_width", 800), + windowConfig.get("resolution_height", 600), + 32); + sf::Uint32 style; + if (windowConfig.get("fullscreen", false)) + style = sf::Style::Fullscreen; + else if (windowConfig.get("borderless", false)) + style = sf::Style::None; + else + style = sf::Style::Titlebar; + tgui::Window window(mode, "Dungeon Gunner", style); + Vector2f::SCREEN_HEIGHT = window.getSize().y; if (!window.globalFont.loadFromFile("res/DejaVuSans.ttf"))