![]() |
Skylicht Engine
|
Central UI event router and input processor. More...
#include <UserInterface/CUIEventManager.h>
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. | |
| CUIBase * | getFocus () |
| 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 |
| CUIBase * | m_focus |
| std::map< int, CUIBase * > | m_multiTouchCapture |
| std::map< int, core::vector2di > | m_pointers |
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:
Threading: Event processing is expected to be invoked from the main/game thread.
Lifetime: CUIEventManager is declared as a singleton via DECLARE_SINGLETON.
|
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.
| event | The input event provided by the engine. |
Implements Skylicht::IEventProcessor.
| 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.
| container | Container to register. |
| void Skylicht::UI::CUIEventManager::setFocus | ( | CUIBase * | focus | ) |
Set keyboard/focus to a given UI element.
Focused element receives keyboard events and focus callbacks.
| focus | Element to receive focus (nullptr to clear focus). |
| 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.
| container | Container to unregister. |