#pragma once #include #include #include #include "yoga/Yoga.h" #include "Nodes/Node.h" #include "Nodes/Canvas.h" #include "../Core/Maths.h" #include "Styling/Stylesheet.h" #include "Font/Font.h" namespace UI { class UserInterface { private: Ref m_Framebuffer; // Texture of the interface. std::string m_Name; Ref Root; YGConfigRef yoga_config; YGNodeRef yoga_root; public: Ref font; const int Width = 1920; const int Height = 1080; UserInterface(const std::string& name); ~UserInterface(); void Reload(); static Ref New(const std::string& name); 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 RecursiveMouseClick(Ref node, Vector2 pos); void ConsumeMouseClick(Vector2 pos); }; }