Skip to content

ImGuiIO

Input typesno constructorsource

Used in get_io, also see set_hotkey and GuiDrawContext::key_picker.

  • Functions are static, not class methods expecting self (call with get_io().keydown(key), not :)
  • The clicked/pressed actions only work in ON.GUIFRAME (they are true for one GUIFRAME), but get_io() can be used anywhere for the other parts.
  • You can use KEY or other standard virtual keycodes < 0xFF to index keys[] or in the functions.
  • You can use chords KEY.OL_MOD_CTRL | KEY.X in the keydown/keypressed/keyreleased functions.
  • You can also use mouse buttons (e.g. KEY.OL_MOUSE_1) or anything returned by GuiDrawContext:key_picker in the keydown/keypressed/keyreleased functions.
  • A modifier key as a keycode (keypressed(KEY.LCONTROL)) is not the same as modifier flags OL_MOD_... keypressed(KEY.OL_MOD_CTRL) won't work, keypressed(KEY.OL_MOD_CTRL | KEY.LSHIFT) will trigger on "Ctrl+Shift" but not "Shift+Ctrl"
  • All held modifiers must be present in the chord, e.g. keypressed(KEY.OL_MOD_CTRL | KEY.X) won't trigger when Ctrl+Shift+X is pressed, keydown(KEY.Y) won't trigger when Ctrl+Y is pressed.
  • Most fields are read only, except wantkeyboard, wantmouse and showcursor.
  • Setting wantkeyboard early (e.g. already when modifierdown(KEY.OL_MOD_CTRL | KEY.X)) will prevent the game and UI from reacting to your actual combo later (e.g. keypressed(KEY.OL_MOD_CTRL | KEY.X))
  • Gamepad is basically XINPUT_GAMEPAD but variables are renamed and values are normalized to -1.0..1.0 range.

Fields

displaysize

Vec2read only

source

framerate

number

source

gamepad

Gamepadread only

source

keyalt

boolean

source

keyctrl

boolean

source

keys

boolean[]read only

ZeroIndexArray of currently held keys, indexed by KEY <= 0xFF

source

keyshift

boolean

source

keysuper

boolean

source

mouseclicked

boolean[]read only

source

mousedoubleclicked

boolean[]read only

source

mousedown

boolean[]read only

source

mousepos

Vec2read only

source

mousereleased

boolean[]read only

source

mousewheel

number

source

showcursor

boolean

True when the cursor is visible. Set to true to force the cursor visible.

source

wantkeyboard

booleanproperty

True if anyone else (i.e. some input box, OL hotkey) is already capturing keyboard or reacted to this keypress and you probably shouldn't. Set this to true every GUIFRAME while you want to capture keyboard and disable UI key bindings and game keys. Won't affect UI or game keys on this frame though, that train has already sailed. Also see Bucket::Overlunky for other ways to override key bindings. Do not set this to false, unless you want the player input to bleed through input fields.

source

wantmouse

booleanproperty

True if anyone else (i.e. hovering some window) is already capturing mouse and you probably shouldn't. Set this to true if you want to capture mouse and override UI mouse binding.

source

Methods

gamepads

function ImGuiIO.gamepads(index: integer): Gamepad
index: integer

Returns Gamepad

Gamepad gamepads(int index) This is the XInput index 1..4, might not be the same as the player slot.

source

keydown

function ImGuiIO.keydown(keycode: integer): boolean
keycode: integer

Returns boolean

function ImGuiIO.keydown(key: integer): boolean
key: integer

Returns boolean

Returns true if key or chord is down. bool keydown(KEY keychord) bool keydown(char key)

source

keypressed

function ImGuiIO.keypressed(keycode: integer): boolean
keycode: integer

Returns boolean

function ImGuiIO.keypressed(keycode: integer, repeat: boolean): boolean
keycode: integer
repeat: boolean

Returns boolean

function ImGuiIO.keypressed(key: integer): boolean
key: integer

Returns boolean

function ImGuiIO.keypressed(key: integer, repeat: boolean): boolean
key: integer
repeat: boolean

Returns boolean

Returns true if key or chord was pressed this GUIFRAME. bool keypressed(KEY keychord, bool repeat = false) bool keypressed(char key, bool repeat = false)

source

keyreleased

function ImGuiIO.keyreleased(keycode: integer): boolean
keycode: integer

Returns boolean

function ImGuiIO.keyreleased(key: integer): boolean
key: integer

Returns boolean

Returns true if key or chord was released this GUIFRAME. bool keyreleased(KEY keychord) bool keyreleased(char key)

source

modifierdown

function ImGuiIO.modifierdown(chord: integer): boolean
chord: integer

Returns boolean

bool modifierdown(KEY keychord) Returns true if modifiers in chord are down, ignores other keys in chord.

source