Skip to main content

Module input

Module input 

Source
Expand description

anvil-overlay.input: keys and mouse buttons for plugins, from the game window’s procedure, held back while the player types in the game or uses Anvil’s panel (anvil_input.h, anvil-overlay 1.18.0).

Depend on the overlay in plugin.toml ([[dependencies]] id = "anvil-overlay", optional = true for a plugin that also works without it) and look the service up with Input::get. A code is a Key: what a setting of type key holds, a mouse button’s virtual key with the same modifiers, or Key(0) for none.

The first binding of a code keeps it: a second one is ErrorCode::Conflict and stays inert until it gets a free code. The handler runs on the game’s main thread after the next outer frame, so it may read World. Without anvil-game, Input::bind is ErrorCode::Unsupported.

Structs§

BindFlags
How a binding treats a press.
Binding
A binding. It is Copy: the overlay keeps it until the process ends.
Input
The anvil-overlay.input service.
Press
A press of a binding’s code.
State
What holds input back now (ANVIL_INPUT_* of state()).

Constants§

SERVICE
The service’s name.
VERSION
The service’s major version.