73 lines
1.8 KiB
C++
73 lines
1.8 KiB
C++
#pragma once
|
|
|
|
#include <XCEngine/UI/DrawData.h>
|
|
|
|
#include <memory>
|
|
#include <string>
|
|
|
|
namespace XCEngine {
|
|
namespace UI {
|
|
struct UIRect;
|
|
struct UIPoint;
|
|
} // namespace UI
|
|
namespace Editor {
|
|
namespace XCUIBackend {
|
|
|
|
struct XCUIDemoInputState {
|
|
UI::UIRect canvasRect = {};
|
|
UI::UIPoint pointerPosition = {};
|
|
bool pointerInside = false;
|
|
bool pointerPressed = false;
|
|
bool pointerReleased = false;
|
|
bool pointerDown = false;
|
|
bool windowFocused = false;
|
|
bool shortcutPressed = false;
|
|
};
|
|
|
|
struct XCUIDemoFrameStats {
|
|
bool documentsReady = false;
|
|
std::string statusMessage = {};
|
|
std::size_t dependencyCount = 0;
|
|
std::size_t elementCount = 0;
|
|
std::size_t dirtyRootCount = 0;
|
|
std::size_t drawListCount = 0;
|
|
std::size_t commandCount = 0;
|
|
std::uint64_t treeGeneration = 0;
|
|
bool accentEnabled = false;
|
|
std::string lastCommandId = {};
|
|
std::string focusedElementId = {};
|
|
std::string hoveredElementId = {};
|
|
};
|
|
|
|
struct XCUIDemoFrameResult {
|
|
UI::UIDrawData drawData = {};
|
|
XCUIDemoFrameStats stats = {};
|
|
};
|
|
|
|
class XCUIDemoRuntime {
|
|
public:
|
|
XCUIDemoRuntime();
|
|
~XCUIDemoRuntime();
|
|
|
|
XCUIDemoRuntime(XCUIDemoRuntime&& other) noexcept;
|
|
XCUIDemoRuntime& operator=(XCUIDemoRuntime&& other) noexcept;
|
|
|
|
XCUIDemoRuntime(const XCUIDemoRuntime&) = delete;
|
|
XCUIDemoRuntime& operator=(const XCUIDemoRuntime&) = delete;
|
|
|
|
bool ReloadDocuments();
|
|
|
|
const XCUIDemoFrameResult& Update(const XCUIDemoInputState& input);
|
|
const XCUIDemoFrameResult& GetFrameResult() const;
|
|
|
|
bool TryGetElementRect(const std::string& elementId, UI::UIRect& outRect) const;
|
|
|
|
private:
|
|
struct RuntimeState;
|
|
std::unique_ptr<RuntimeState> m_state;
|
|
};
|
|
|
|
} // namespace XCUIBackend
|
|
} // namespace Editor
|
|
} // namespace XCEngine
|