Raw key/mouse state from the window, plus cursor grabbing.
Movement/action keybinds and overrides live in options.
| Function | What it does |
|---|---|
input.key_down(code) |
true while a key is held (GLFW code, e.g. 32 = space) |
input.mouse_down(btn) |
true while a mouse button is held (0 left, 1 right, 2 middle) |
input.mouse_pos() |
Cursor x, y in render_2d canvas pixels |
input.mouse_locked() |
true while the cursor is grabbed |
input.lock() |
Grabs the cursor (hides and locks it) |
input.unlock() |
Releases the cursor |
if input.key_down(340) then -- left shift
local x, y = input.mouse_pos()
print(x, y)
end