Integrate XCUI runtime context into SceneRuntime

This commit is contained in:
2026-04-05 06:52:17 +08:00
parent edf434aa03
commit d46dcbfa9e
7 changed files with 323 additions and 2 deletions

View File

@@ -0,0 +1,64 @@
#include <XCEngine/UI/Runtime/UISceneRuntimeContext.h>
namespace XCEngine {
namespace UI {
namespace Runtime {
UISceneRuntimeContext::UISceneRuntimeContext()
: m_system(m_documentHost)
, m_stackController(m_system) {
}
UISystem& UISceneRuntimeContext::GetSystem() {
return m_system;
}
const UISystem& UISceneRuntimeContext::GetSystem() const {
return m_system;
}
UIScreenStackController& UISceneRuntimeContext::GetStackController() {
return m_stackController;
}
const UIScreenStackController& UISceneRuntimeContext::GetStackController() const {
return m_stackController;
}
const UISystemFrameResult& UISceneRuntimeContext::GetLastFrame() const {
return m_system.GetLastFrame();
}
void UISceneRuntimeContext::Reset() {
m_stackController.Clear();
m_system.DestroyAllPlayers();
m_pendingFrameInput = {};
m_nextFrameIndex = 1u;
}
void UISceneRuntimeContext::SetViewportRect(const UIRect& viewportRect) {
m_pendingFrameInput.viewportRect = viewportRect;
}
void UISceneRuntimeContext::SetFocused(bool focused) {
m_pendingFrameInput.focused = focused;
}
void UISceneRuntimeContext::QueueInputEvent(const UIInputEvent& event) {
m_pendingFrameInput.events.push_back(event);
}
void UISceneRuntimeContext::ClearQueuedInputEvents() {
m_pendingFrameInput.events.clear();
}
void UISceneRuntimeContext::Update(double deltaTimeSeconds) {
m_pendingFrameInput.deltaTimeSeconds = deltaTimeSeconds;
m_pendingFrameInput.frameIndex = m_nextFrameIndex++;
m_system.Update(m_pendingFrameInput);
m_pendingFrameInput.events.clear();
}
} // namespace Runtime
} // namespace UI
} // namespace XCEngine