Isle
|
[AI] Handles keyboard, mouse, and joystick input for the game. More...
#include <legoinputmanager.h>
Public Types | |
enum | Keys { c_left = 0x01 , c_right = 0x02 , c_up = 0x04 , c_down = 0x08 , c_ctrl = 0x10 , c_leftOrRight = c_left | c_right , c_upOrDown = c_up | c_down } |
[AI] Key flags for common navigation keys and bitwise combinations used for state queries. More... | |
![]() | |
enum | TickleState { e_idle = 0 , e_ready , e_starting , e_streaming , e_repeating , e_freezing , e_done } |
[AI] Represents the state of the presenter's tickle (update) lifecycle. More... | |
Public Member Functions | |
LegoInputManager () | |
[AI] Initialize default state: input device handles, notification lists, and member flags. [AI] More... | |
~LegoInputManager () override | |
[AI] Clean up and release all acquired input devices, notification lists, control managers, and event queues. [AI] More... | |
void | QueueEvent (NotificationId p_id, MxU8 p_modifier, MxLong p_x, MxLong p_y, MxU8 p_key) |
[AI] Add an input event (for mouse, keyboard, or joystick) to the processing queue, or process immediately based on flags/state. More... | |
void | Register (MxCore *) |
[AI] Register a core object as a recipient for keyboard events; safe for concurrent multi-threading. More... | |
void | UnRegister (MxCore *) |
[AI] Unregister a previously registered recipient so it will no longer receive input notifications. More... | |
MxResult | Tickle () override |
[AI] Updates input and processes the event queue. More... | |
MxResult | PutData () override |
[AI] No-op, always returns SUCCESS. Place-holder for presenter put-data protocol. More... | |
MxResult | Create (HWND p_hwnd) |
[AI] Set up DirectInput and joystick state, instantiate controller and notification list. More... | |
void | Destroy () override |
[AI] Release all allocated DirectInput devices, notification lists, event queues, and control manager. [AI] More... | |
void | CreateAndAcquireKeyboard (HWND p_hwnd) |
[AI] Create keyboard input device and acquire focus for the given window handle. More... | |
void | ReleaseDX () |
[AI] Unacquire and release all DirectInput device interfaces (keyboard). [AI] More... | |
MxResult | GetJoystickId () |
[AI] Scan for valid joystick ID based on preferred index or check all available joysticks. More... | |
MxResult | GetJoystickState (MxU32 *p_joystickX, MxU32 *p_joystickY, DWORD *p_buttonsState, MxU32 *p_povPosition) |
[AI] Retrieve state of the currently assigned joystick device and normalized position/button state. More... | |
void | StartAutoDragTimer () |
[AI] Start the Windows timer used for distinguishing auto drag events during mouse interaction. [AI] More... | |
void | StopAutoDragTimer () |
[AI] Stop the running auto drag timer if any. [AI] More... | |
void | EnableInputProcessing () |
[AI] Enable event queue and input event processing. Resets relevant state. [AI] More... | |
void | SetCamera (LegoCameraController *p_camera) |
[AI] Assigns a new camera controller for mouse/look operations. More... | |
void | ClearCamera () |
[AI] Remove any assigned camera controller, disabling camera navigation responses. [AI] More... | |
void | SetWorld (LegoWorld *p_world) |
[AI] Assigns the current world to receive mouse/click/pick notifications. More... | |
void | ClearWorld () |
[AI] Remove any world assignment (used to clear targeting/scene changes). [AI] More... | |
void | SetUnknown88 (MxBool p_unk0x88) |
[AI] Set general-purpose input block flag (purpose: temporary input disable during drag or transitions). More... | |
void | SetUnknown335 (MxBool p_unk0x335) |
[AI] Typically used to allow button-down event processing during partial-blocked states. More... | |
void | SetUnknown336 (MxBool p_unk0x336) |
[AI] Enables accepting input only for space-bar events (used in special UI states). More... | |
void | SetUseJoystick (MxBool p_useJoystick) |
[AI] Enable or disable joystick support in input processing. More... | |
void | SetJoystickIndex (MxS32 p_joystickIndex) |
[AI] Set user-preferred joystick device index (overrides auto-detection). More... | |
void | DisableInputProcessing () |
[AI] Block most input processing, allowing only button-down and space events (UI modal input blocking). More... | |
LegoControlManager * | GetControlManager () |
[AI] Retrieve the active control manager, responsible for UI and main action mapping. More... | |
LegoWorld * | GetWorld () |
[AI] Retrieve the currently assigned LegoWorld for scene and actor event notifications. More... | |
LegoCameraController * | GetCamera () |
[AI] Returns the current camera controller. More... | |
void | ProcessEvents () |
[AI] Dispatch processing of all queued input events until the queue is empty or processing requests exit. More... | |
MxBool | ProcessOneEvent (LegoEventNotificationParam &p_param) |
[AI] Processes a single input event (key, mouse click, drag, etc.), sending it to appropriate targets. More... | |
MxBool | FUN_1005cdf0 (LegoEventNotificationParam &p_param) |
[AI] Complex drag/click/timer event filter. More... | |
void | GetKeyboardState () |
[AI] Polls DirectInput for current keyboard state. Updates m_keyboardState and success flag. [AI] More... | |
MxResult | GetNavigationKeyStates (MxU32 &p_keyFlags) |
[AI] Retrieves current navigation (arrow) key status from the keyboard, combining keypad and arrow keys into bitmask. More... | |
![]() | |
MxPresenter () | |
[AI] Constructor. Initializes internal tickle state and other members. More... | |
MxResult | Tickle () override |
[AI] Main tickle handler, called periodically to progress presenter's internal state. More... | |
virtual void | VTable0x14 () |
[AI] Reserved for future or specialized use in derived classes. More... | |
virtual void | ReadyTickle () |
[AI] Handles the transition and setup for the Ready state. Parses extra action data and advances state. More... | |
virtual void | StartingTickle () |
[AI] Handles actions required when first starting presentation. Advances to streaming state. More... | |
virtual void | StreamingTickle () |
[AI] Handles periodic updates during the streaming/presentation stage. Advances to repeating state. More... | |
virtual void | RepeatingTickle () |
[AI] Handles updates when in a repeating (looping) stage. Advances to freezing state. More... | |
virtual void | FreezingTickle () |
[AI] Handles updates during the freezing/suspended state. Advances to done state. More... | |
~MxPresenter () override | |
[AI] Destructor, cleans up resources (base class: does nothing beyond Init). More... | |
virtual MxResult | AddToManager () |
[AI] Optional registration with a manager (such as TickleManager); by default does nothing. More... | |
virtual void | Destroy () |
[AI] Resets presenter state or cleans up resources after completion/removal. More... | |
virtual MxResult | StartAction (MxStreamController *, MxDSAction *) |
[AI] Initiates presenter for a new action, setting up context and state. More... | |
virtual void | EndAction () |
[AI] Terminates the current action, notifies listeners and resets state. More... | |
virtual void | SetTickleState (TickleState p_tickleState) |
[AI] Forces the tickle state, advancing to the requested lifecycle stage. More... | |
virtual MxBool | HasTickleStatePassed (TickleState p_tickleState) |
[AI] Checks if the specified tickle state has ever been passed since last reset. More... | |
virtual MxResult | PutData () |
[AI] Allows the presenter to submit pending results or output to the engine. More... | |
virtual MxBool | IsHit (MxS32 p_x, MxS32 p_y) |
[AI] Returns TRUE if the given (x, y) falls within hit-test bounds for the presenter (e.g. More... | |
virtual void | Enable (MxBool p_enable) |
[AI] Enables or disables this presenter (controls action flags accordingly). More... | |
const char * | ClassName () const override |
[AI] Returns the run-time class name for this presenter. More... | |
MxBool | IsA (const char *p_name) const override |
[AI] Determines if this object is of (or inherits) the specified named class. More... | |
MxEntity * | CreateEntity (const char *p_defaultName) |
[AI] Creates an entity based on action 'extra' data, or uses the provided default name. More... | |
void | SendToCompositePresenter (MxOmni *p_omni) |
[AI] Notifies a composite presenter (if one exists) that this presenter wishes to join a group. More... | |
MxBool | IsEnabled () |
[AI] Returns whether this presenter is logically enabled (based on the associated action's flags). More... | |
MxS32 | GetCurrentTickleState () const |
[AI] Returns the current tickle state. More... | |
MxPoint32 | GetLocation () const |
[AI] Returns the presenter's screen location (in pixels). More... | |
MxS32 | GetX () const |
[AI] Returns the X coordinate of screen location. More... | |
MxS32 | GetY () const |
[AI] Returns the Y coordinate of screen location. More... | |
MxS32 | GetDisplayZ () const |
[AI] Returns the display Z (depth) order. More... | |
MxDSAction * | GetAction () const |
[AI] Returns the current action being presented. More... | |
void | SetAction (MxDSAction *p_action) |
[AI] Sets the action associated with this presenter. More... | |
void | SetCompositePresenter (MxCompositePresenter *p_compositePresenter) |
[AI] Sets the composite presenter to notify/join on completion. More... | |
void | SetDisplayZ (MxS32 p_displayZ) |
[AI] Sets the display Z (depth) order for the presenter. More... | |
![]() | |
MxCore () | |
[AI] Constructs a new MxCore object and assigns it a unique id. More... | |
virtual | ~MxCore () |
[AI] Virtual destructor. Required for correct polymorphic cleanup in derived classes. More... | |
virtual MxLong | Notify (MxParam &p_param) |
[AI] Virtual callback notification mechanism. More... | |
virtual MxResult | Tickle () |
[AI] Called by tickle managers to allow the object to update itself. More... | |
virtual const char * | ClassName () const |
[AI] Returns the runtime class name of this object. More... | |
virtual MxBool | IsA (const char *p_name) const |
[AI] Checks whether this object's class type or parents match the given name. More... | |
MxU32 | GetId () |
[AI] Gets the unique (per-process) id assigned to this object instance. More... | |
Additional Inherited Members | |
![]() | |
static const char * | HandlerClassName () |
[AI] Returns the handler class name for identification and reflection purposes. More... | |
![]() | |
virtual void | DoneTickle () |
[AI] Handles any post-completion logic, resetting to idle state. More... | |
virtual void | ParseExtra () |
[AI] Parses additional data from the associated action for configuration or world interaction. More... | |
void | ProgressTickleState (TickleState p_tickleState) |
[AI] Helper for advancing the presenter's tickle state and updating transition history. More... | |
void | Init () |
[AI] Initializes object state to post-construction defaults. More... | |
![]() | |
TickleState | m_currentTickleState |
[AI] Current state in the tickle lifecycle. More... | |
MxU32 | m_previousTickleStates |
[AI] Bitfield representing all tickle states that have already occurred during this lifetime. More... | |
MxPoint32 | m_location |
[AI] 2D display location for the presenter. More... | |
MxS32 | m_displayZ |
[AI] Z-order value for display stacking. More... | |
MxDSAction * | m_action |
[AI] The associated action currently being presented by this presenter. More... | |
MxCriticalSection | m_criticalSection |
[AI] Thread synchronization for presenter state and data. More... | |
MxCompositePresenter * | m_compositePresenter |
[AI] Owner composite presenter, if any. More... | |
[AI] Handles keyboard, mouse, and joystick input for the game.
Central input system that tracks platform input devices and manages event notification and processing. Responsible for processing DirectInput keyboard events, Windows joystick input, and mouse events.
Registers and notifies listeners of key/button/mouse actions, manages drag/timing logic, and interacts with camera and world objects to impart navigation and click/drag operations. Controls input availability/focus and their event flows. [AI]
Definition at line 57 of file legoinputmanager.h.
[AI] Key flags for common navigation keys and bitwise combinations used for state queries.
Definition at line 61 of file legoinputmanager.h.
LegoInputManager::LegoInputManager | ( | ) |
[AI] Initialize default state: input device handles, notification lists, and member flags. [AI]
Definition at line 29 of file legoinputmanager.cpp.
|
override |
[AI] Clean up and release all acquired input devices, notification lists, control managers, and event queues. [AI]
Definition at line 56 of file legoinputmanager.cpp.
void LegoInputManager::ClearCamera | ( | ) |
[AI] Remove any assigned camera controller, disabling camera navigation responses. [AI]
Definition at line 322 of file legoinputmanager.cpp.
void LegoInputManager::ClearWorld | ( | ) |
[AI] Remove any world assignment (used to clear targeting/scene changes). [AI]
Definition at line 336 of file legoinputmanager.cpp.
MxResult LegoInputManager::Create | ( | HWND | p_hwnd | ) |
[AI] Set up DirectInput and joystick state, instantiate controller and notification list.
p_hwnd | Window handle whose instance/input context should be used. [AI] |
Definition at line 62 of file legoinputmanager.cpp.
void LegoInputManager::CreateAndAcquireKeyboard | ( | HWND | p_hwnd | ) |
[AI] Create keyboard input device and acquire focus for the given window handle.
p_hwnd | Window handle to acquire for keyboard input [AI] |
Definition at line 109 of file legoinputmanager.cpp.
|
overridevirtual |
[AI] Release all allocated DirectInput devices, notification lists, event queues, and control manager. [AI]
Reimplemented from MxPresenter.
Definition at line 88 of file legoinputmanager.cpp.
|
inline |
[AI] Block most input processing, allowing only button-down and space events (UI modal input blocking).
Definition at line 171 of file legoinputmanager.h.
void LegoInputManager::EnableInputProcessing | ( | ) |
[AI] Enable event queue and input event processing. Resets relevant state. [AI]
Definition at line 585 of file legoinputmanager.cpp.
MxBool LegoInputManager::FUN_1005cdf0 | ( | LegoEventNotificationParam & | p_param | ) |
[AI] Complex drag/click/timer event filter.
Determines if/when to convert mouse motion into clicks or drags.
p_param | Input event (may be updated to reflect drag state) [AI] |
Definition at line 486 of file legoinputmanager.cpp.
|
inline |
[AI] Returns the current camera controller.
Definition at line 187 of file legoinputmanager.h.
|
inline |
[AI] Retrieve the active control manager, responsible for UI and main action mapping.
Definition at line 179 of file legoinputmanager.h.
MxResult LegoInputManager::GetJoystickId | ( | ) |
[AI] Scan for valid joystick ID based on preferred index or check all available joysticks.
Sets up internal JOYCAPS.
Definition at line 207 of file legoinputmanager.cpp.
MxResult LegoInputManager::GetJoystickState | ( | MxU32 * | p_joystickX, |
MxU32 * | p_joystickY, | ||
DWORD * | p_buttonsState, | ||
MxU32 * | p_povPosition | ||
) |
[AI] Retrieve state of the currently assigned joystick device and normalized position/button state.
p_joystickX | Normalized X axis (0-100) [AI] |
p_joystickY | Normalized Y axis (0-100) [AI] |
p_buttonsState | Joystick button bitmask [AI] |
p_povPosition | POV (hat) position (degrees/100 or -1 if centered) [AI] |
Definition at line 239 of file legoinputmanager.cpp.
void LegoInputManager::GetKeyboardState | ( | ) |
[AI] Polls DirectInput for current keyboard state. Updates m_keyboardState and success flag. [AI]
Definition at line 141 of file legoinputmanager.cpp.
[AI] Retrieves current navigation (arrow) key status from the keyboard, combining keypad and arrow keys into bitmask.
p_keyFlags | Output for combined key status (bitmask of enum Keys). [AI] |
Definition at line 161 of file legoinputmanager.cpp.
|
inline |
[AI] Retrieve the currently assigned LegoWorld for scene and actor event notifications.
Definition at line 183 of file legoinputmanager.h.
void LegoInputManager::ProcessEvents | ( | ) |
[AI] Dispatch processing of all queued input events until the queue is empty or processing requests exit.
Definition at line 353 of file legoinputmanager.cpp.
MxBool LegoInputManager::ProcessOneEvent | ( | LegoEventNotificationParam & | p_param | ) |
[AI] Processes a single input event (key, mouse click, drag, etc.), sending it to appropriate targets.
Applies drag/click logic, entity and UI focus resolution. Returns TRUE if the event caused an exclusive action.
p_param | Input event description [AI] |
Definition at line 366 of file legoinputmanager.cpp.
|
inlineoverridevirtual |
[AI] No-op, always returns SUCCESS. Place-holder for presenter put-data protocol.
Reimplemented from MxPresenter.
Definition at line 98 of file legoinputmanager.h.
void LegoInputManager::QueueEvent | ( | NotificationId | p_id, |
MxU8 | p_modifier, | ||
MxLong | p_x, | ||
MxLong | p_y, | ||
MxU8 | p_key | ||
) |
[AI] Add an input event (for mouse, keyboard, or joystick) to the processing queue, or process immediately based on flags/state.
p_id | Notification type (e.g., key press, mouse click) [AI] |
p_modifier | Modifier flags (e.g., mouse button state, key modifiers) [AI] |
p_x | X screen coordinate [AI] |
p_y | Y screen coordinate [AI] |
p_key | Key code (virtual key, DIK_*, etc.) [AI] |
Definition at line 342 of file legoinputmanager.cpp.
void LegoInputManager::Register | ( | MxCore * | p_notify | ) |
[AI] Register a core object as a recipient for keyboard events; safe for concurrent multi-threading.
p_notify | MxCore* to add to keyboard notification list [AI] |
Definition at line 294 of file legoinputmanager.cpp.
void LegoInputManager::ReleaseDX | ( | ) |
[AI] Unacquire and release all DirectInput device interfaces (keyboard). [AI]
Definition at line 126 of file legoinputmanager.cpp.
void LegoInputManager::SetCamera | ( | LegoCameraController * | p_camera | ) |
[AI] Assigns a new camera controller for mouse/look operations.
p_camera | Camera controller to use (may be NULL to disable camera actions) [AI] |
Definition at line 316 of file legoinputmanager.cpp.
|
inline |
[AI] Set user-preferred joystick device index (overrides auto-detection).
p_joystickIndex | Preferred joystick index to use [AI] |
Definition at line 168 of file legoinputmanager.h.
|
inline |
[AI] Typically used to allow button-down event processing during partial-blocked states.
p_unk0x335 | New value for flag [AI] |
Definition at line 156 of file legoinputmanager.h.
|
inline |
[AI] Enables accepting input only for space-bar events (used in special UI states).
p_unk0x336 | New value for flag [AI] |
Definition at line 160 of file legoinputmanager.h.
|
inline |
[AI] Set general-purpose input block flag (purpose: temporary input disable during drag or transitions).
p_unk0x88 | TRUE to block input, FALSE to allow [AI] |
Definition at line 152 of file legoinputmanager.h.
|
inline |
[AI] Enable or disable joystick support in input processing.
p_useJoystick | TRUE to use joystick, FALSE to ignore joystick [AI] |
Definition at line 164 of file legoinputmanager.h.
void LegoInputManager::SetWorld | ( | LegoWorld * | p_world | ) |
[AI] Assigns the current world to receive mouse/click/pick notifications.
p_world | World for click/drag event targeting [AI] |
Definition at line 329 of file legoinputmanager.cpp.
void LegoInputManager::StartAutoDragTimer | ( | ) |
[AI] Start the Windows timer used for distinguishing auto drag events during mouse interaction. [AI]
Definition at line 570 of file legoinputmanager.cpp.
void LegoInputManager::StopAutoDragTimer | ( | ) |
[AI] Stop the running auto drag timer if any. [AI]
Definition at line 577 of file legoinputmanager.cpp.
|
overridevirtual |
[AI] Updates input and processes the event queue.
Called by the tickle system each frame or input 'tick'.
Reimplemented from MxCore.
void LegoInputManager::UnRegister | ( | MxCore * | p_notify | ) |
[AI] Unregister a previously registered recipient so it will no longer receive input notifications.
p_notify | MxCore* to remove [AI] |
Definition at line 305 of file legoinputmanager.cpp.