fullScreen, esc key to exit

This commit is contained in:
Adrian Charkiewicz 2021-02-01 00:33:46 +01:00
parent 042572f519
commit b564ce57cf
2 changed files with 14 additions and 8 deletions

View File

@ -49,7 +49,7 @@
<ProjectGuid>{1B448102-E76C-4347-BDC7-40D02A567DB6}</ProjectGuid> <ProjectGuid>{1B448102-E76C-4347-BDC7-40D02A567DB6}</ProjectGuid>
<Keyword>Win32Proj</Keyword> <Keyword>Win32Proj</Keyword>
<RootNamespace>grk-cw9</RootNamespace> <RootNamespace>grk-cw9</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion> <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>grk-project</ProjectName> <ProjectName>grk-project</ProjectName>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
@ -57,14 +57,14 @@
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v141</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v141</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings"> <ImportGroup Label="ExtensionSettings">

View File

@ -17,13 +17,14 @@
#include <assimp/scene.h> #include <assimp/scene.h>
#include <assimp/postprocess.h> #include <assimp/postprocess.h>
#include "model.h" #include "model.h"
#include <WinUser.h>
int SCR_WIDTH = 1240; int SCR_WIDTH = 1240;
int SCR_HEIGHT = 720; int SCR_HEIGHT = 720;
#define STB_IMAGE_IMPLEMENTATION #define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h" #include "stb_image.h"
//int winId; int winId;
GLuint programTex; GLuint programTex;
GLuint programSkybox; GLuint programSkybox;
GLuint programSun; 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 '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 '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 '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 main(int argc, char** argv)
{ {
int screenWidth = GetSystemMetrics(SM_CXSCREEN);
int screenHeight = GetSystemMetrics(SM_CYSCREEN);
SCR_WIDTH = screenWidth; SCR_HEIGHT = screenHeight;
glutInit(&argc, argv); glutInit(&argc, argv);
glutSetOption(GLUT_MULTISAMPLE, 8); glutSetOption(GLUT_MULTISAMPLE, 8);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH | GLUT_MULTISAMPLE); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH | GLUT_MULTISAMPLE);
glEnable(GL_MULTISAMPLE); glEnable(GL_MULTISAMPLE);
glutInitWindowPosition(100, 200); glutInitWindowPosition(0, 0);
glutInitWindowSize(SCR_WIDTH, SCR_HEIGHT); glutInitWindowSize(SCR_WIDTH, SCR_HEIGHT);
glutCreateWindow("GRK-PROJECT WIP"); //glutCreateWindow("GRK-PROJECT WIP");
//winId = glutCreateWindow("OpenGL + PhysX"); winId = glutCreateWindow("GRK-PROJECT WIP");
//glutFullScreen(); glutFullScreen();
glewInit(); glewInit();
init(); init();