Skylicht Engine
Loading...
Searching...
No Matches
Skylicht::UI::CUIEventManager Class Reference

Central UI event router and input processor. More...

#include <UserInterface/CUIEventManager.h>

Inheritance diagram for Skylicht::UI::CUIEventManager:
Skylicht::IEventProcessor

Public Member Functions

 CUIEventManager ()
 Constructor. Initializes internal state.
virtual ~CUIEventManager ()
 Destructor. Cleans up any state if necessary.
virtual bool OnProcessEvent (const SEvent &event)
 Implementation of IEventProcessor::OnProcessEvent.
void registerUIContainer (CUIContainer *container)
 Register a UI container to receive routed events.
void unregisterUIContainer (CUIContainer *container)
 Unregister a UI container so it no longer receives events.
void setMultiTouchCapture (int pointerId, CUIBase *base)
void setCapture (int pointerId, CUIBase *base)
void setFocus (CUIBase *focus)
 Set keyboard/focus to a given UI element.
void clearFocus ()
 Clear current focus.
CUIBasegetFocus ()
 Get the element that currently has keyboard/focus.
int getPointerX (int id)
 Get the last known pointer world X coordinate.
int getPointerY (int id)
 Get the last known pointer world Y coordinate.
void resetTouch ()
 Should call when resume application.

Protected Attributes

std::vector< CUIContainer * > m_containers
CUIBasem_focus
std::map< int, CUIBase * > m_multiTouchCapture
std::map< int, core::vector2di > m_pointers

Detailed Description

Central UI event router and input processor.

CUIEventManager implements IEventProcessor and acts as the global bridge between low-level engine input events (SEvent) and the UI system (CUIContainer / CUIBase). It manages a list of active UI containers, routes pointer/keyboard events to the correct container or UI element, and maintains focus/capture state for higher-level UI interactions.

Responsibilities:

  • Register/unregister UI containers that should receive events.
  • Maintain capture and focus semantics for UI elements.
  • Track the current pointer position and pointer id for multi-pointer systems.
  • Convert and forward SEvent instances to the appropriate container(s).

Threading: Event processing is expected to be invoked from the main/game thread.

Lifetime: CUIEventManager is declared as a singleton via DECLARE_SINGLETON.

Member Function Documentation

◆ OnProcessEvent()

virtual bool Skylicht::UI::CUIEventManager::OnProcessEvent ( const SEvent & event)
virtual

Implementation of IEventProcessor::OnProcessEvent.

Receives an SEvent from the engine and routes it to registered CUIContainer instances. Responsible for updating captured/focused elements and for translating low-level input into UI pointer/key events.

Parameters
eventThe input event provided by the engine.
Returns
true if the event was handled by the UI and should not be further processed; false to allow propagation.

Implements Skylicht::IEventProcessor.

◆ registerUIContainer()

void Skylicht::UI::CUIEventManager::registerUIContainer ( CUIContainer * container)

Register a UI container to receive routed events.

The container will be added to the internal list and will participate when routing input events. Duplicate registration is ignored.

Parameters
containerContainer to register.

◆ setFocus()

void Skylicht::UI::CUIEventManager::setFocus ( CUIBase * focus)

Set keyboard/focus to a given UI element.

Focused element receives keyboard events and focus callbacks.

Parameters
focusElement to receive focus (nullptr to clear focus).

◆ unregisterUIContainer()

void Skylicht::UI::CUIEventManager::unregisterUIContainer ( CUIContainer * container)

Unregister a UI container so it no longer receives events.

Removes the container from internal routing lists. If the container is not registered this is a no-op.

Parameters
containerContainer to unregister.

The documentation for this class was generated from the following file: