input-state
Canonical Import
fennel
(local input-state (require :input-state))Source Files
src/lua_input_state.cppsrc/lua_runtime.cpp
What It Provides
input-state exposes keyboard, mouse, gamepad, touch, and pen state objects plus constants for key, pen axis, and pen input flags.
API Summary
- Constants:
KeyStatus,PenAxis, andPenInputFlags. InputState()creates an input state object.- Keyboard, mouse, gamepad, touch, and pen state types expose state predicates such as
is-up,is-free,is-just-pressed,is-down,is-held, andis-just-releasedplus device-specific fields. InputStatemethods and properties includekeyboard,mouse,gamepad-count,primary-gamepad-id,touch-count,pen-count,begin-frame, event ingestion methods,gamepad-by-id,gamepad-ids,gamepads,touch-by-id,touch-ids,touches,pen-by-id,pen-ids,pens,pen-events, andpen-axis-values.
Examples
fennel
(local input-state (require :input-state))
(local input (input-state.InputState))
(input:begin-frame)
(local mouse input.mouse)
(print (mouse:x) (mouse:y))Errors and Platform Notes
Input state reflects SDL-backed events supplied by the host; a newly created state has no live input until event methods are driven. Device ids and pen axes depend on available hardware and platform support.
Related Modules
dial-typefor chorded gamepad/input interpretation.enginefor the runtime that usually owns input event flow.
Aliases and Search Terms
Search terms: keyboard, mouse, gamepad, touch, pen, SDL input.
