From d433de7efaeacd1852f80690fe5fdc5b8881f665 Mon Sep 17 00:00:00 2001 From: Ray Date: Sun, 24 Apr 2022 11:02:50 +0200 Subject: [PATCH] Initialize (reset) input global state #2360 --- src/rcore.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/rcore.c b/src/rcore.c index b7a96938f..4d0883f2a 100644 --- a/src/rcore.c +++ b/src/rcore.c @@ -179,7 +179,7 @@ #include // Required for: srand(), rand(), atexit() #include // Required for: sprintf() [Used in OpenURL()] -#include // Required for: strrchr(), strcmp(), strlen() +#include // Required for: strrchr(), strcmp(), strlen(), memset() #include // Required for: time() [Used in InitTimer()] #include // Required for: tan() [Used in BeginMode3D()], atan2f() [Used in LoadVrStereoConfig()] @@ -754,8 +754,9 @@ void InitWindow(int width, int height, const char *title) #endif if ((title != NULL) && (title[0] != 0)) CORE.Window.title = title; - - // Initialize required global values different than 0 + + // Initialize global input state + memset(&CORE.Input, 0, sizeof(CORE.Input)); CORE.Input.Keyboard.exitKey = KEY_ESCAPE; CORE.Input.Mouse.scale = (Vector2){ 1.0f, 1.0f }; CORE.Input.Mouse.cursor = MOUSE_CURSOR_ARROW;