Introducing windowed fullscreen. Closes #9.
This commit is contained in:
parent
36173438cc
commit
40da86aad6
@ -3,6 +3,8 @@
|
||||
<height>786</height>
|
||||
</resolution>
|
||||
|
||||
<windowedFullscreen>true</windowedFullscreen>
|
||||
|
||||
<shadowCubeSize>1024</shadowCubeSize>
|
||||
|
||||
<farPlane>150.0</farPlane>
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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"));
|
||||
|
28
game/main.cc
28
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
|
||||
|
Loading…
Reference in New Issue
Block a user