← Back to Documentation Index

⌨️ Text Input

Keyboard text input handling for game UI

📋 Overview

The Text Input system handles keyboard text entry for things like player names, chat, and text fields in menus.

⌨️ Text Functions

createTextInput(x, y, maxLength)

Creates a text input field.

x, y number - Position on screen
maxLength number - Maximum characters (default: 20)
Returns: object - Text input object
Example:
const nameInput = createTextInput(100, 100, 10);
updateTextInput(input)

Updates text input (call each frame).

input object - Text input object
Returns: void - No return value
Example:
updateTextInput(nameInput);
getInputText(input)

Gets the current text value.

input object - Text input object
Returns: string - Current text
Example:
const name = getInputText(nameInput);