Update rcore.c

This commit is contained in:
Nickolas McDonald 2023-08-19 21:49:09 -04:00
parent 5bfe3b063a
commit a14176e89d

View File

@ -3751,7 +3751,7 @@ void OpenURL(const char *url)
// Check if a key has been pressed once // Check if a key has been pressed once
bool IsKeyPressed(int key) bool IsKeyPressed(int key)
{ {
return IsKeyDown(key) && (CORE.Input.Keyboard.previousKeyState[key] == 0); return KEY_SAFE(key) && (CORE.Input.Keyboard.previousKeyState[key] == 0) && (CORE.Input.Keyboard.currentKeyState[key] == 1);
} }
// Check if a key is being pressed (key held down) // Check if a key is being pressed (key held down)
@ -3763,7 +3763,7 @@ bool IsKeyDown(int key)
// Check if a key has been released once // Check if a key has been released once
bool IsKeyReleased(int key) bool IsKeyReleased(int key)
{ {
return IsKeyUp(key) && (CORE.Input.Keyboard.previousKeyState[key] == 1); return KEY_SAFE(key) && (CORE.Input.Keyboard.previousKeyState[key] == 1) && (CORE.Input.Keyboard.currentKeyState[key] == 0);
} }
// Check if a key is NOT being pressed (key not held down) // Check if a key is NOT being pressed (key not held down)