Skip to content
Axiom/Docs
Capabilities / input.observe

input.observe

@1

Key and pointer state, and binding a hotkey the overlay lets the user rebind.

Observe is the whole of it: there is no call here that moves a pointer or presses a key, and that is not an omission. The host owns input routing across a whole press and release, because a key down delivered to the game and a key up captured by a newly opened overlay leaves the game believing the key is held.

4 callsSurface as of 2026-10-21

Calls

down
down(key: str) -> Result<bool>

A key by name, as a person writes one: "F8", "H", "Ctrl+R". Names rather than scan codes, because a scan code is a keyboard layout a mod should not have an opinion about.

In C, from surface.h
int32_t axiom_input_observe_down(const char* key, uint32_t key_length, int32_t* out);
cursor
cursor() -> Result<Vec2>

Where the cursor is, in screen points, and whether the game has it captured. A mod reading a position while the game holds the cursor is reading one nobody is moving.

Called cursor rather than pointer because the surface refuses a mod-visible call that names a pointer, and it is right to: a reader who has to work out which kind of pointer is meant is a reader who can get it wrong.

In C, from surface.h
int32_t axiom_input_observe_cursor(AxiomVec2* out);
captured
captured() -> Result<bool>
In C, from surface.h
int32_t axiom_input_observe_captured(int32_t* out);
bindWRITES
bind(id: str, label: str, preferred: str) -> Result<>

Asks for a hotkey the user can rebind in the overlay. The binding belongs to the user, so this says what the mod wants it for and the host decides what it ends up as.

In C, from surface.h
int32_t axiom_input_observe_bind(const char* id, uint32_t id_length, const char* label, uint32_t label_length, const char* preferred, uint32_t preferred_length);

Events

boundid: str, key: str

Errors

A call that returns Result crosses as a status: 0 is success, and the others are these errors, by their index in the capability.

UnsupportedUnknownBinding