summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSteven Fuller <relnev@icculus.org>2008-06-08 23:44:02 -0700
committerPatryk Obara <dreamer.tan@gmail.com>2019-08-20 02:22:37 +0200
commitfc69f56b9af0392fa10375696ea1e1292c3a2aa7 (patch)
tree2b9c7172e14607a00aa1b751d00fdd8bde087816 /src
parent6efffab0c5b6bfb93474c7b74e093bdfa302e23f (diff)
Fixed input not working when coming out of a game.
Diffstat (limited to 'src')
-rw-r--r--src/main.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index 154e07d..11eaa94 100644
--- a/src/main.c
+++ b/src/main.c
@@ -493,6 +493,14 @@ int SetSoftVideoMode(int Width, int Height, int Depth)
isgrab = SDL_GRAB_OFF;
}
+ // reset input
+ memset((void*) KeyboardInput, 0, MAX_NUMBER_OF_INPUT_KEYS);
+ GotAnyKey = 0;
+
+ // force restart the video system
+ SDL_QuitSubSystem(SDL_INIT_VIDEO);
+ SDL_InitSubSystem(SDL_INIT_VIDEO);
+
if ((surface = SDL_SetVideoMode(Width, Height, Depth, flags)) == NULL) {
fprintf(stderr, "(Software) SDL SetVideoMode failed: %s\n", SDL_GetError());
exit(EXIT_FAILURE);
@@ -551,6 +559,14 @@ int SetOGLVideoMode(int Width, int Height)
isgrab = SDL_GRAB_OFF;
}
+ // reset input
+ memset((void*) KeyboardInput, 0, MAX_NUMBER_OF_INPUT_KEYS);
+ GotAnyKey = 0;
+
+ // force restart the video system
+ SDL_QuitSubSystem(SDL_INIT_VIDEO);
+ SDL_InitSubSystem(SDL_INIT_VIDEO);
+
load_opengl_library(opengl_library);
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);