summary refs log tree commit diff
path: root/src/GameInitDispose.cpp
diff options
context:
space:
mode:
authorNguyễn Gia Phong <mcsinyx@disroot.org>2021-09-12 00:28:36 +0700
committerNguyễn Gia Phong <mcsinyx@disroot.org>2021-09-12 00:31:47 +0700
commit62445a15b14a059032d7c0c3e16a959d25bff604 (patch)
tree4c0aba823939c3d266bc447dfe6c51fa4f2c0f1a /src/GameInitDispose.cpp
parente3614a94b984d12baa7f4f6010b6707805ce0928 (diff)
downloadblackshades-2.2.0.tar.gz
Make window resizable 2.2.0
Diffstat (limited to 'src/GameInitDispose.cpp')
-rw-r--r--src/GameInitDispose.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/GameInitDispose.cpp b/src/GameInitDispose.cpp
index 2d2a5c4..1c8cffb 100644
--- a/src/GameInitDispose.cpp
+++ b/src/GameInitDispose.cpp
@@ -58,11 +58,16 @@ extern int aimkey;
 extern int psychicaimkey;
 extern int psychickey;
 
+void resizeWindow(Game* game, int width, int height)
+{
+	game->screenwidth = width;
+	game->screenheight = height;
+}
+
 Game* makeGame(Config config)
 {
 	auto game = new Game();
-	game->screenwidth = config.width;
-	game->screenheight = config.height;
+	resizeWindow(game, config.width, config.height);
 	game->usermousesensitivity = config.mouse_sensitivity;
 	game->mousesensitivity = game->usermousesensitivity;
 	game->debug = config.debug;
@@ -1811,9 +1816,6 @@ void initGl(Game* game)
 
 GLvoid Game::ReSizeGLScene(float fov, float near)
 {
-	if (screenheight==0)
-		screenheight=1;
-
 	glViewport(0,0,screenwidth,screenheight);
 	glMatrixMode(GL_PROJECTION);
 	glLoadIdentity();