23 using FactoryFunc = std::function<std::unique_ptr<UINode>(
const Node *)>;
24 std::unordered_map<std::string, FactoryFunc> m_registry;
26 std::unordered_map<std::string, std::shared_ptr<GPUTexture>> m_textureCache;
27 std::unordered_set<std::string> m_usedTextures;
29 std::shared_ptr<GPUTexture> loadTexture(
const std::string &src, SDL_GPUDevice *device);
31 void registerComponent(
const std::string &type,
32 std::function<std::unique_ptr<UINode>(
const Node &)> func) {
33 m_registry[type] = [func = std::move(func)](
const Node *n) -> std::unique_ptr<UINode> {
34 return n ? func(*n) :
nullptr;
38 template <
typename F,
typename = std::enable_if_t<std::is_invocable_v<F>>>
39 void registerComponent(
const std::string &type, F &&func) {
40 m_registry[type] = [func = std::forward<F>(func)](
const Node *) -> std::unique_ptr<UINode> {
45 std::unique_ptr<UINode> buildNode(
const Node &dataNode);
47 void applyAttributes(
UINode *node,
const Node &dataNode);
49 SDL_GPUDevice *m_device =
nullptr;
Manages an isolated user interface canvas workspace sandbox, hosting its own independent node tree an...