Input API

The Input API provides access to mouse, keyboard, and UI-hover information from Lua scripts. These functions are intended to be used inside on_frame().


🖱 Mouse Input

Mouse Position

x, y = get_mouse_pos()

Returns the cursor position inside the game/overlay window.

x, y = get_mouse_pos_desktop()

Returns the cursor position in desktop/screen coordinates.


Mouse Delta

dx, dy = get_mouse_delta()

Movement since last frame in overlay space.

dx, dy = get_mouse_delta_desktop()

Movement since last frame in desktop space.


Scroll Wheel

amount = get_scroll_delta()

Positive for scroll up, negative for scroll down.


Movement Event

Returns true if the mouse moved this frame.


Hover Detection

Returns true if the mouse is inside the rectangle (x, y, w, h).


⌨️ Keyboard Input

Key Down

Returns true while key is held.

Raw Down

Reflects OS-level down state before filtering.

Fired

Behaves like text input

Toggle

Toggles each time the key is pressed (flip-flop behavior).

Single Press

True only on the first frame the key is pressed.

Previous State

State from the previous frame.


🔍 Full Key State

Returns all internal state fields for a virtual key.


🧩 Keys Down List

Returns a Lua table of all currently pressed virtual keys.

Example:


📝 Text Input & Key Names

Recent Typed Characters

Returns a string of recently typed characters (from your internal text buffer).

Key Name

Returns a readable name like "SPACE", "A", "SHIFT".


📌 Example


💡 Notes

  • vk refers to Windows Virtual-Key codes (e.g., 0x41 = 'A', 0x20 = Space).

  • The Input API is frame-based and intended to be called from inside on_frame().

  • get_recent_key_input() is ideal for text input boxes or consoles.

Last updated