From b564ce57cf8c8b7f3f96716fc2e3ac907e764aea Mon Sep 17 00:00:00 2001 From: Adrian Charkiewicz Date: Mon, 1 Feb 2021 00:33:46 +0100 Subject: [PATCH] fullScreen, esc key to exit --- grk-project.vcxproj | 6 +++--- src/main.cpp | 16 +++++++++++----- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/grk-project.vcxproj b/grk-project.vcxproj index 3cabe13..da1317a 100644 --- a/grk-project.vcxproj +++ b/grk-project.vcxproj @@ -49,7 +49,7 @@ {1B448102-E76C-4347-BDC7-40D02A567DB6} Win32Proj grk-cw9 - 10.0.17134.0 + 10.0 grk-project @@ -57,14 +57,14 @@ Application true Unicode - v141 + v142 Application false true Unicode - v141 + v142 diff --git a/src/main.cpp b/src/main.cpp index 5a78149..4315f05 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -17,13 +17,14 @@ #include #include #include "model.h" +#include int SCR_WIDTH = 1240; int SCR_HEIGHT = 720; #define STB_IMAGE_IMPLEMENTATION #include "stb_image.h" -//int winId; +int winId; GLuint programTex; GLuint programSkybox; GLuint programSun; @@ -130,6 +131,7 @@ void keyboard(unsigned char key, int x, int y) case 'a': cameraPos -= glm::cross(cameraDir, glm::vec3(0, 1, 0)) * moveSpeed; break; case 'z': cameraPos += glm::cross(cameraDir, glm::vec3(0, 0, 1)) * moveSpeed; break; case 'x': cameraPos -= glm::cross(cameraDir, glm::vec3(0, 0, 1)) * moveSpeed; break; + case 27: glutDestroyWindow(winId); break; } } @@ -520,15 +522,19 @@ void idle() int main(int argc, char** argv) { + int screenWidth = GetSystemMetrics(SM_CXSCREEN); + int screenHeight = GetSystemMetrics(SM_CYSCREEN); + SCR_WIDTH = screenWidth; SCR_HEIGHT = screenHeight; + glutInit(&argc, argv); glutSetOption(GLUT_MULTISAMPLE, 8); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH | GLUT_MULTISAMPLE); glEnable(GL_MULTISAMPLE); - glutInitWindowPosition(100, 200); + glutInitWindowPosition(0, 0); glutInitWindowSize(SCR_WIDTH, SCR_HEIGHT); - glutCreateWindow("GRK-PROJECT WIP"); - //winId = glutCreateWindow("OpenGL + PhysX"); - //glutFullScreen(); + //glutCreateWindow("GRK-PROJECT WIP"); + winId = glutCreateWindow("GRK-PROJECT WIP"); + glutFullScreen(); glewInit(); init();