diff --git a/data/config.xml b/data/config.xml
index 81c106d..615f72a 100644
--- a/data/config.xml
+++ b/data/config.xml
@@ -3,6 +3,8 @@
786
+true
+
1024
150.0
diff --git a/game/application.cc b/game/application.cc
index db882e0..f1c0884 100644
--- a/game/application.cc
+++ b/game/application.cc
@@ -145,3 +145,11 @@ void Application::startGame() {
bool Application::isGameStarted() {
return gameStarted;
}
+
+void Application::setFullscreen(bool state) {
+ this->fullscreen = state;
+}
+
+bool Application::makeFullscreen() {
+ return fullscreen;
+}
diff --git a/game/application.hh b/game/application.hh
index be205de..13f9846 100644
--- a/game/application.hh
+++ b/game/application.hh
@@ -35,7 +35,10 @@ class Application {
void setLoadingScreenContinuePath(std::string path);
bool isGameStarted();
void startGame();
+ void setFullscreen(bool state);
+ bool makeFullscreen();
private:
+ bool fullscreen;
bool gameStarted;
int ignoredMouseUpdates;
bool focused;
diff --git a/game/loader.cc b/game/loader.cc
index df0f17b..9cd2a45 100644
--- a/game/loader.cc
+++ b/game/loader.cc
@@ -17,6 +17,7 @@ void Loader::loadConfig(Application* application) {
application->setWindowWidth(queryInt(resolution, "width"));
application->setWindowHeight(queryInt(resolution, "height"));
+ application->setFullscreen(queryBool(config, "windowedFullscreen"));
application->setShadowCubeSize(queryInt(config, "shadowCubeSize"));
application->setFarPlane(queryFloat(config, "farPlane"));
application->setMaxShadowRenderCount(queryInt(config, "maxShadowRenderCount"));
diff --git a/game/main.cc b/game/main.cc
index aa40c58..0075841 100644
--- a/game/main.cc
+++ b/game/main.cc
@@ -112,12 +112,28 @@ bool createWindow()
// define whether the window can get resized:
glfwWindowHint(GLFW_RESIZABLE, true);
- // try to create an OpenGL context in a window and check the supported OpenGL version:
- // R,G,B,A, Depth,Stencil
- window = glfwCreateWindow(app.getGraphics()->getWindowSize().x, app.getGraphics()->getWindowSize().y, "SWP MarbleGame Group C", NULL, NULL);
- if (!window) {
- ACGL::Utils::error() << "Failed to open a GLFW window - requested OpenGL: " << ACGL_OPENGL_VERSION << std::endl;
- return false;
+ if(app.makeFullscreen()) {
+ const GLFWvidmode* mode = glfwGetVideoMode(glfwGetPrimaryMonitor());
+
+ glfwWindowHint(GLFW_RED_BITS, mode->redBits);
+ glfwWindowHint(GLFW_GREEN_BITS, mode->greenBits);
+ glfwWindowHint(GLFW_BLUE_BITS, mode->blueBits);
+ glfwWindowHint(GLFW_REFRESH_RATE, mode->refreshRate);
+ window = glfwCreateWindow(mode->width, mode->height, "Saxum", glfwGetPrimaryMonitor(), NULL);
+
+ if (!window) {
+ ACGL::Utils::error() << "Failed to open a GLFW window - requested OpenGL: " << ACGL_OPENGL_VERSION << std::endl;
+ return false;
+ }
+ }
+ else {
+ // try to create an OpenGL context in a window and check the supported OpenGL version:
+ // R,G,B,A, Depth,Stencil
+ window = glfwCreateWindow(app.getGraphics()->getWindowSize().x, app.getGraphics()->getWindowSize().y, "Saxum", NULL, NULL);
+ if (!window) {
+ ACGL::Utils::error() << "Failed to open a GLFW window - requested OpenGL: " << ACGL_OPENGL_VERSION << std::endl;
+ return false;
+ }
}
glfwMakeContextCurrent(window);
#ifdef SAXUM_DEBUG