diff options
| author | Nguyễn Gia Phong <mcsinyx@disroot.org> | 2021-09-12 13:15:32 +0700 |
|---|---|---|
| committer | Nguyễn Gia Phong <mcsinyx@disroot.org> | 2021-09-12 13:15:32 +0700 |
| commit | 4b4adf45b0326ebd902909c07ea78a397fb01300 (patch) | |
| tree | 07902fc5b62e63e567adbe145f83fc07b88128a6 /src/GameInitDispose.cpp | |
| parent | 53053553629793154247deb594dcc384f872b6f5 (diff) | |
| download | blackshades-4b4adf45b0326ebd902909c07ea78a397fb01300.tar.gz | |
Reduce number of glViewport calls
Diffstat (limited to 'src/GameInitDispose.cpp')
| -rw-r--r-- | src/GameInitDispose.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/GameInitDispose.cpp b/src/GameInitDispose.cpp index 1c8cffb..ef5770e 100644 --- a/src/GameInitDispose.cpp +++ b/src/GameInitDispose.cpp @@ -62,21 +62,22 @@ void resizeWindow(Game* game, int width, int height) { game->screenwidth = width; game->screenheight = height; + glViewport(0, 0, width, height); } Game* makeGame(Config config) { auto game = new Game(); - resizeWindow(game, config.width, config.height); - game->usermousesensitivity = config.mouse_sensitivity; - game->mousesensitivity = game->usermousesensitivity; - game->debug = config.debug; + game->screenwidth = config.width; + game->screenheight = config.height; game->vblsync = config.vsync; - blood = config.blood; game->blurness = config.blur; - game->mainmenuness = config.menu; - game->customlevels = config.custom_levels; + blood = config.blood; + game->musictoggle = config.music; + + game->usermousesensitivity = config.mouse_sensitivity; + game->mousesensitivity = game->usermousesensitivity; forwardskey = GLFW_KEY_W; backwardskey = GLFW_KEY_S; leftkey = GLFW_KEY_A; @@ -85,6 +86,10 @@ Game* makeGame(Config config) psychicaimkey = GLFW_KEY_E; psychickey = GLFW_KEY_Z; + game->mainmenuness = config.menu; + game->customlevels = config.custom_levels; + game->debug = config.debug; + if (!game->initialized) { // TODO: Read high score ifstream ipstream2 {"highscore.txt"}; @@ -1816,7 +1821,6 @@ void initGl(Game* game) GLvoid Game::ReSizeGLScene(float fov, float near) { - glViewport(0,0,screenwidth,screenheight); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(fov,(GLfloat)screenwidth/(GLfloat)screenheight,near,viewdistance); |
