summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/GameDraw.cpp22
-rw-r--r--src/GameInitDispose.cpp20
2 files changed, 33 insertions, 9 deletions
diff --git a/src/GameDraw.cpp b/src/GameDraw.cpp
index 9b7c1c5..9848232 100644
--- a/src/GameDraw.cpp
+++ b/src/GameDraw.cpp
@@ -1,3 +1,24 @@
+// Game drawing
+// Copyright (C) 2002  David Rosen
+// Copyright (C) 2003  Ryan C. Gordon
+// Copyright (C) 2003  Steven Fuller
+// Copyright (C) 2021  Nguyễn Gia Phong
+//
+// This file is part of Black Shades.
+//
+// Black Shades is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published
+// by the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Black Shades is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Black Shades.  If not, see <https://www.gnu.org/licenses/>.
+
 #include "Game.h"
 
 extern int thirdperson;
@@ -37,7 +58,6 @@ int Game::DrawGLScene(void)
 		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 
 		//"Black Shades"
-		ReSizeGLScene(90.0f, 0.1f);
 		glDisable(GL_TEXTURE_2D);
 		glDisable(GL_DEPTH_TEST);							// Disables Depth Testing
 		glDisable(GL_CULL_FACE);
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);