PointClickEngine::Core::InputManager
Inherits PointClickEngine::Core::IInputManager < PointClickEngine::Core::GameConstants < PointClickEngine::Core::ErrorHelpers < Reference < Object
Manages all input-related operations including event processing, input state, and coordination
The InputManager centralizes input handling logic that was previously scattered throughout the Engine class. It provides priority-based input processing, input blocking for UI elements, and coordinated event handling.
Features
- Priority-based input processing
- Input blocking for dialogs and UI
- Event coordination between systems
- Input state tracking and validation
- Keyboard and mouse event handling
- Customizable input mappings
Usage
manager = InputManager.new
manager.add_input_handler(ui_handler, priority: 10)
manager.add_input_handler(game_handler, priority: 5)
manager.process_input(dt)
Constructors
Instance methods
Add an input handler with priority
Higher priority handlers are processed first. UI handlers should typically have higher priority than game handlers.
- handler : The input processing function
- priority : Processing priority (higher = first)
- enabled : Whether the handler is initially enabled
Block all input for a specified number of frames
Useful for preventing input during scene transitions or scripted sequences.
- frames : Number of frames to block input
- source : Description of what is blocking input
Mark an input as consumed
- input_type : Type of input to mark as consumed
- handler_name : Name of the handler consuming the input
Check if a specific input has been consumed
- input_type : Type of input to check (e.g., "mouse_click", "key_space")
Returns true if the input has been consumed this frame
Main input processing method
Processes all input events and distributes them to registered handlers based on priority. Updates input state and handles frame-based cleanup.
- dt : Delta time since last frame
Register a named input handler with a block
Named handlers are easier to manage and remove later. The handler should return true if it consumed the input.
- name : Unique name for the handler
- priority : Processing priority (higher = first)
- enabled : Whether the handler is initially enabled
Register a named input handler (non-block version)
For simpler cases where you just need a placeholder handler. Creates a no-op handler that doesn't consume input.
- name : Unique name for the handler
- priority : Processing priority (higher = first)
- enabled : Whether the handler is initially enabled
Enable or disable an input handler
Unregister a named input handler
- name : Name of the handler to remove
Returns true if the handler was found and removed
Update the input manager state
This is an alias for process_input for API compatibility.
- dt : Delta time since last frame