Added config file for resolution and window style.
This commit is contained in:
parent
518ec95549
commit
cfa93ca213
2 changed files with 17 additions and 3 deletions
4
res/yaml/window.yaml
Normal file
4
res/yaml/window.yaml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
resolution_width: 1024
|
||||||
|
resolution_height: 768
|
||||||
|
fullscreen: false
|
||||||
|
borderless: false
|
16
src/main.cpp
16
src/main.cpp
|
@ -17,12 +17,22 @@
|
||||||
*/
|
*/
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
Yaml::setFolder("res/yaml/");
|
Yaml::setFolder("res/yaml/");
|
||||||
|
|
||||||
Loader::i().setFolder("res/");
|
Loader::i().setFolder("res/");
|
||||||
Loader::i().setSubFolder<sf::Texture>("textures/");
|
Loader::i().setSubFolder<sf::Texture>("textures/");
|
||||||
|
|
||||||
tgui::Window window(sf::VideoMode(1024, 768, 32), "Dungeon Gunner",
|
Yaml windowConfig("window.yaml");
|
||||||
sf::Style::Close | sf::Style::Titlebar);
|
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;
|
Vector2f::SCREEN_HEIGHT = window.getSize().y;
|
||||||
|
|
||||||
if (!window.globalFont.loadFromFile("res/DejaVuSans.ttf"))
|
if (!window.globalFont.loadFromFile("res/DejaVuSans.ttf"))
|
||||||
|
|
Reference in a new issue