Overview
Dear ImGui uses theImGuiKey enum which contains all possible keyboard, mouse, and gamepad inputs. The keyboard key enum values are named after the keys on a standard US keyboard.
Key State Functions
IsKeyDown
Key to check (e.g.,
ImGuiKey_A, ImGuiKey_Space)True if key is currently down
IsKeyPressed
Key to check
If true, returns true on key repeat. Repeat rate uses
io.KeyRepeatDelay / io.KeyRepeatRate.True if key was just pressed or repeating
IsKeyReleased
Key to check
True if key was just released
GetKeyPressedAmount
Key to check
Time before repeat starts
Repeat rate
Number of key presses this frame
Key Chords
IsKeyChordPressed
Key chord (e.g.,
ImGuiMod_Ctrl | ImGuiKey_S)True if the key chord was pressed
Consider using
Shortcut() instead, which supports focus routing and is more feature-complete.Key Names
GetKeyName
Key to get name for
Key name string
Keyboard Capture
SetNextFrameWantCaptureKeyboard
io.WantCaptureKeyboard flag next frame. Equivalent to setting io.WantCaptureKeyboard after the next NewFrame() call.
Whether to capture keyboard
ImGuiKey Enum
Keyboard Modifiers
On macOS, Dear ImGui swaps Cmd(Super) and Ctrl keys at the time of
io.AddKeyEvent() call.