51 lines
1.6 KiB
C++
51 lines
1.6 KiB
C++
#pragma once
|
|
|
|
#include <XCEngine/UI/Runtime/UIScreenPlayer.h>
|
|
|
|
#include <cstddef>
|
|
#include <memory>
|
|
#include <vector>
|
|
|
|
namespace XCEngine {
|
|
namespace UI {
|
|
namespace Runtime {
|
|
|
|
class UISystem {
|
|
public:
|
|
explicit UISystem(IUIScreenDocumentHost& documentHost);
|
|
|
|
UIScreenPlayer& CreatePlayer(const UIScreenLayerOptions& options = UIScreenLayerOptions());
|
|
UIScreenLayerId PushScreen(
|
|
const UIScreenAsset& asset,
|
|
const UIScreenLayerOptions& options = UIScreenLayerOptions());
|
|
bool RemoveLayer(UIScreenLayerId layerId);
|
|
bool SetLayerVisibility(UIScreenLayerId layerId, bool visible);
|
|
bool SetLayerOptions(UIScreenLayerId layerId, const UIScreenLayerOptions& options);
|
|
const UIScreenLayerOptions* FindLayerOptions(UIScreenLayerId layerId) const;
|
|
UIScreenLayerId GetLayerId(std::size_t index) const;
|
|
void DestroyAllPlayers();
|
|
|
|
std::size_t GetPlayerCount() const;
|
|
std::size_t GetLayerCount() const;
|
|
|
|
const UISystemFrameResult& Update(const UIScreenFrameInput& input);
|
|
void Tick(const UIScreenFrameInput& input);
|
|
const UISystemFrameResult& GetLastFrame() const;
|
|
|
|
const std::vector<std::unique_ptr<UIScreenPlayer>>& GetPlayers() const;
|
|
|
|
private:
|
|
std::size_t FindLayerIndex(UIScreenLayerId layerId) const;
|
|
|
|
IUIScreenDocumentHost* m_documentHost = nullptr;
|
|
std::vector<std::unique_ptr<UIScreenPlayer>> m_players = {};
|
|
std::vector<UIScreenLayerId> m_layerIds = {};
|
|
std::vector<UIScreenLayerOptions> m_layerOptions = {};
|
|
UISystemFrameResult m_lastFrame = {};
|
|
UIScreenLayerId m_nextLayerId = 1;
|
|
};
|
|
|
|
} // namespace Runtime
|
|
} // namespace UI
|
|
} // namespace XCEngine
|