| 7 | namespace obe::System |
| 8 | { |
| 9 | Window::Window(vili::node configuration) |
| 10 | { |
| 11 | if (configuration.contains("width")) |
| 12 | { |
| 13 | if (configuration.at("width").is<vili::integer>()) |
| 14 | m_width = configuration.at("width"); |
| 15 | else if (configuration.at("width").is<vili::string>()) |
| 16 | { |
| 17 | if (configuration.at("width").as<vili::string>() == "fill") |
| 18 | m_width = Transform::UnitVector::Screen.w; |
| 19 | } |
| 20 | } |
| 21 | else |
| 22 | m_width = Transform::UnitVector::Screen.w; |
| 23 | |
| 24 | if (configuration.contains("height")) |
| 25 | { |
| 26 | if (configuration.at("height").is<vili::integer>()) |
| 27 | m_height = configuration.at("height"); |
| 28 | else if (configuration.at("height").is<vili::string>()) |
| 29 | { |
| 30 | if (configuration.at("height").as<vili::string>() == "fill") |
| 31 | m_height = Transform::UnitVector::Screen.h; |
| 32 | } |
| 33 | } |
| 34 | else |
| 35 | m_height = Transform::UnitVector::Screen.h; |
| 36 | |
| 37 | bool fullscreen = true; |
| 38 | bool closeable = true; |
| 39 | bool resizeable = true; |
| 40 | bool titlebar = true; |
| 41 | |
| 42 | if (configuration.contains("fullscreen")) |
| 43 | fullscreen = configuration.at("fullscreen"); |
| 44 | if (configuration.contains("closeable")) |
| 45 | closeable = configuration.at("closeable"); |
| 46 | if (configuration.contains("resizeable")) |
| 47 | resizeable = configuration.at("resizeable"); |
| 48 | if (configuration.contains("titlebar")) |
| 49 | titlebar = configuration.at("titlebar"); |
| 50 | |
| 51 | m_style = sf::Style::Default; |
| 52 | if (fullscreen) |
| 53 | m_style = sf::Style::Fullscreen; |
| 54 | else |
| 55 | { |
| 56 | if (closeable) |
| 57 | m_style |= sf::Style::Close; |
| 58 | if (resizeable) |
| 59 | m_style |= sf::Style::Resize; |
| 60 | if (titlebar) |
| 61 | m_style |= sf::Style::Titlebar; |
| 62 | } |
| 63 | |
| 64 | std::string title = "ObEngine"; |
| 65 | if (configuration.contains("title")) |
| 66 | m_title = configuration.at("title"); |