Module src.backends.null.command_menu
Null backend in‐game command menu.
Provides a minimal select‐and‐input overlay for manual control when no real backend is attached.
Functions
CommandMenu:new () | Create a new CommandMenu instance. |
CommandMenu:toggle () | Toggle menu visibility. |
CommandMenu:keypressed (key) | Handle a key press event. |
CommandMenu:textinput (t) | Collect text input in input mode. |
CommandMenu:draw (x, y) | Draw the command menu overlay. |
Functions
- CommandMenu:new ()
-
Create a new CommandMenu instance.
Initially hidden and in select mode.
Returns:
-
CommandMenu
New command‐menu object
- CommandMenu:toggle ()
- Toggle menu visibility. When hiding, resets to select mode and clears any input.
- CommandMenu:keypressed (key)
-
Handle a key press event.
In select mode, chooses a command key or exits.
In input mode, edits buffer or submits the command.
Parameters:
- key string The key that was pressed
Returns:
-
[nil]
The message to send when Enter is pressed; otherwise nil
- CommandMenu:textinput (t)
-
Collect text input in input mode.
Allows only valid numeric characters (digits, dot, leading minus).
Parameters:
- t string The character input
- CommandMenu:draw (x, y)
-
Draw the command menu overlay.
Renders a semi‐transparent background and the current prompt.
Parameters:
- x number[opt] X coordinate (default 50)
- y number[opt] Y coordinate (default 50)