From cfa93ca2132f8a09971b4f6f5c062507f0060a69 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Tue, 17 Sep 2013 23:18:12 +0200 Subject: [PATCH] Added config file for resolution and window style. --- res/yaml/window.yaml | 4 ++++ src/main.cpp | 16 +++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 res/yaml/window.yaml 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"))