Browse Source

Added config file for resolution and window style.

master
Felix Ableitner 8 years ago
parent
commit
cfa93ca213
  1. 4
      res/yaml/window.yaml
  2. 16
      src/main.cpp

4
res/yaml/window.yaml

@ -0,0 +1,4 @@
resolution_width: 1024
resolution_height: 768
fullscreen: false
borderless: false

16
src/main.cpp

@ -17,12 +17,22 @@
*/
int main(int argc, char* argv[]) {
Yaml::setFolder("res/yaml/");
Loader::i().setFolder("res/");
Loader::i().setSubFolder<sf::Texture>("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"))