Browse Source

added control and alt checking

pull/4851/head
Mike Thielen 1 week ago
parent
commit
a12bc488f4
2 changed files with 12 additions and 0 deletions
  1. +2
    -0
      src/raylib.h
  2. +10
    -0
      src/rcore.c

+ 2
- 0
src/raylib.h View File

@ -1177,6 +1177,8 @@ RLAPI void PlayAutomationEvent(AutomationEvent event); // Play a reco
RLAPI bool IsKeyPressed(int key); // Check if a key has been pressed once
RLAPI bool IsKeyPressedRepeat(int key); // Check if a key has been pressed again
RLAPI bool IsKeyDown(int key); // Check if a key is being pressed
RLAPI bool IsControlKeyDown(); // Check if any control key is being pressed
RLAPI bool IsAltKeyDown(); // Check if any alt key is being pressed
RLAPI bool IsKeyReleased(int key); // Check if a key has been released once
RLAPI bool IsKeyUp(int key); // Check if a key is NOT being pressed
RLAPI int GetKeyPressed(void); // Get key pressed (keycode), call it multiple times for keys queued, returns 0 when the queue is empty

+ 10
- 0
src/rcore.c View File

@ -3184,6 +3184,16 @@ bool IsKeyDown(int key)
return down;
}
bool IsControlKeyDown()
{
return IsKeyDown(KEY_LEFT_CONTROL) || IsKeyDown(KEY_RIGHT_CONTROL);
}
bool IsAltKeyDown()
{
return IsKeyDown(KEY_LEFT_ALT) || IsKeyDown(KEY_RIGHT_ALT);
}
// Check if a key has been released once
bool IsKeyReleased(int key)
{

Loading…
Cancel
Save