euca-input) is pure data: an InputState snapshot (pressed / just-pressed keys, mouse,
scroll, gamepad), an ActionMap binding InputKeys to named actions, and an InputContextStack (Gameplay
/ Menu / Editor) that decides which bindings are active. The mental model: every input endpoint mutates one
of those resources — so an endpoint works only where its resource is present. This page walks the bind and
context flow, and shows exactly how to tell a no-op from a real effect; every command is real and runnable
against a local server, with output from one.
Bind a key (and prove whether it stuck)
/input/bind validates key and action, then writes to the ActionMap only if one exists. On the bare
headless host there’s no ActionMap, so the call returns success but /input/list stays empty — that
contrast is how you know:
key or action is rejected before it ever touches the map:
Push and pop a context (works headless)
The headless host carries anInputContextStack, initialized with a base Gameplay context, so push and pop
both take effect. Push a menu context and it pops right back:
/input/context/pop refuses only when you’d pop the base context — pop again with just Gameplay left and
you get {"ok":false,"message":"Cannot pop last context"}. The stack guards its floor; it never empties.
What a host that registers the resources gets
The data and operations all exist ineuca-input; they just need the resources present:
- Bindings —
ActionMap::bindmaps anInputKey(Key(name),MouseLeft/MouseRight/MouseMiddle, gamepad buttons/axes) to a named action;active_actions/just_started_actionsquery them. With anActionMapregistered, the bind above would appear in/input/listas{"key":"W","action":"move_forward"}. - Context stack — push/pop
Gameplay/Menu/Editorto switch which bindings apply. - Gamepad —
GamepadStatetracks axes and buttons per gamepad id. - Snapshots —
InputSnapshot::capture()/apply_to()for server-side networked replay.
Endpoints
Status
- Shipped —
ActionMapbindings, the context stack, the gamepad abstraction, and input snapshots, all as headless serializable data ineuca-input. - Host-dependent — The headless host registers an
InputContextStack(so context push/pop work) but noActionMap, so/input/bindaccepts calls and stores nothing (verified above). A windowed or input-aware host registers anActionMap, after which the bind endpoints take effect.
Input endpoints
Bind, unbind, list, and context endpoints with request and response schemas.