#pragma once #include #include #include #include "yoga/Yoga.h" #include "Nodes/Node.h" #include "Nodes/Canvas.h" #include "src/Core/Maths.h" #include "Styling/Stylesheet.h" #include "Font/Font.h" #include #include namespace Nuake { namespace UI { class UserInterface { private: std::string m_Name; std::string m_Path; Ref m_Framebuffer; // Texture of the interface. Ref Root; YGConfigRef yoga_config; YGNodeRef yoga_root; std::vector m_Scripts; Ref GetNodeByIDRecurse(Ref node, const std::string& id); void RecursiveHover(Ref node, Vector2 pos); public: Ref font; const int Width = 1920; const int Height = 1080; Vector2 Size = Vector2(); UserInterface(const std::string& name, const std::string& path); ~UserInterface(); void Reload(); static Ref New(const std::string& name, const std::string& path); void Calculate(int available_width, int available_height); void CreateYogaLayout(); void CreateYogaLayoutRecursive(Ref node, YGNodeRef yoga_node); void Draw(Vector2 size); void DrawRecursive(Ref node, float z); void Update(Timestep ts); void RecursiveStyle(Ref node); void RecursiveMouseClick(Ref node, Vector2 pos); Ref GetNodeByID(const std::string& id); void ConsumeMouseClick(Vector2 pos); std::string GetPath() const { return m_Path; } }; } }