Integrate XCUI shell state and runtime frame seams
This commit is contained in:
@@ -19,6 +19,7 @@ public:
|
||||
const UIScreenStackController& GetStackController() const;
|
||||
|
||||
const UISystemFrameResult& GetLastFrame() const;
|
||||
UISystemFrameResult ConsumeLastFrame();
|
||||
|
||||
void Reset();
|
||||
void SetViewportRect(const UIRect& viewportRect);
|
||||
|
||||
@@ -20,6 +20,7 @@ public:
|
||||
const UIScreenAsset* GetAsset() const;
|
||||
const UIScreenDocument* GetDocument() const;
|
||||
const UIScreenFrameResult& GetLastFrame() const;
|
||||
UIScreenFrameResult ConsumeLastFrame();
|
||||
const std::string& GetLastError() const;
|
||||
std::uint64_t GetPresentedFrameCount() const;
|
||||
|
||||
|
||||
@@ -89,9 +89,13 @@ struct UISystemPresentedLayer {
|
||||
struct UISystemFrameResult {
|
||||
UIDrawData drawData = {};
|
||||
std::vector<UISystemPresentedLayer> layers = {};
|
||||
UIRect viewportRect = {};
|
||||
std::size_t presentedLayerCount = 0;
|
||||
std::size_t skippedLayerCount = 0;
|
||||
std::size_t submittedInputEventCount = 0;
|
||||
std::uint64_t frameIndex = 0;
|
||||
double deltaTimeSeconds = 0.0;
|
||||
bool focused = false;
|
||||
std::string errorMessage = {};
|
||||
};
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ public:
|
||||
const UISystemFrameResult& Update(const UIScreenFrameInput& input);
|
||||
void Tick(const UIScreenFrameInput& input);
|
||||
const UISystemFrameResult& GetLastFrame() const;
|
||||
UISystemFrameResult ConsumeLastFrame();
|
||||
|
||||
const std::vector<std::unique_ptr<UIScreenPlayer>>& GetPlayers() const;
|
||||
|
||||
|
||||
@@ -29,6 +29,10 @@ const UISystemFrameResult& UISceneRuntimeContext::GetLastFrame() const {
|
||||
return m_system.GetLastFrame();
|
||||
}
|
||||
|
||||
UISystemFrameResult UISceneRuntimeContext::ConsumeLastFrame() {
|
||||
return m_system.ConsumeLastFrame();
|
||||
}
|
||||
|
||||
void UISceneRuntimeContext::Reset() {
|
||||
m_stackController.Clear();
|
||||
m_system.DestroyAllPlayers();
|
||||
|
||||
@@ -75,6 +75,12 @@ const UIScreenFrameResult& UIScreenPlayer::GetLastFrame() const {
|
||||
return m_lastFrame;
|
||||
}
|
||||
|
||||
UIScreenFrameResult UIScreenPlayer::ConsumeLastFrame() {
|
||||
UIScreenFrameResult frame = std::move(m_lastFrame);
|
||||
m_lastFrame = {};
|
||||
return frame;
|
||||
}
|
||||
|
||||
const std::string& UIScreenPlayer::GetLastError() const {
|
||||
return m_lastError;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include <XCEngine/UI/Runtime/UISystem.h>
|
||||
|
||||
#include <utility>
|
||||
|
||||
namespace XCEngine {
|
||||
namespace UI {
|
||||
namespace Runtime {
|
||||
@@ -122,6 +124,10 @@ std::size_t UISystem::GetLayerCount() const {
|
||||
const UISystemFrameResult& UISystem::Update(const UIScreenFrameInput& input) {
|
||||
m_lastFrame = {};
|
||||
m_lastFrame.frameIndex = input.frameIndex;
|
||||
m_lastFrame.viewportRect = input.viewportRect;
|
||||
m_lastFrame.submittedInputEventCount = input.events.size();
|
||||
m_lastFrame.deltaTimeSeconds = input.deltaTimeSeconds;
|
||||
m_lastFrame.focused = input.focused;
|
||||
|
||||
if (m_players.empty()) {
|
||||
return m_lastFrame;
|
||||
@@ -177,6 +183,12 @@ const UISystemFrameResult& UISystem::GetLastFrame() const {
|
||||
return m_lastFrame;
|
||||
}
|
||||
|
||||
UISystemFrameResult UISystem::ConsumeLastFrame() {
|
||||
UISystemFrameResult frame = std::move(m_lastFrame);
|
||||
m_lastFrame = {};
|
||||
return frame;
|
||||
}
|
||||
|
||||
const std::vector<std::unique_ptr<UIScreenPlayer>>& UISystem::GetPlayers() const {
|
||||
return m_players;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user