#pragma once namespace UI { struct Point { float x = 0.0f; float y = 0.0f; }; struct Size { float width = 0.0f; float height = 0.0f; bool operator==(const Size& other) const { return width == other.width && height == other.height; } bool operator!=(const Size& other) const { return !(*this == other); } }; class Thickness { public: float Left = 0.0f; float Top = 0.0f; float Right = 0.0f; float Bottom = 0.0f; Thickness() = default; Thickness(float uniform) : Left(uniform), Top(uniform), Right(uniform), Bottom(uniform) {} Thickness(float width, float height) : Left(width), Top(height), Right(width), Bottom(height) {} Thickness(float left, float top, float right, float bottom) : Left(left), Top(top), Right(right), Bottom(bottom) {} bool operator==(const Thickness& other) const { return Left == other.Left && Top == other.Top && Right == other.Right && Bottom == other.Bottom; } bool operator!=(const Thickness& other) const { return !(*this == other); } float HorizontalTotal() const { return Left + Right; } float VerticalTotal() const { return Top + Bottom; } }; class Rect { public: float X = 0.0f; float Y = 0.0f; float Width = 0.0f; float Height = 0.0f; Rect() = default; Rect(float x, float y, float width, float height) : X(x), Y(y), Width(width), Height(height) {} Rect(Point pos, Size size) : X(pos.x), Y(pos.y), Width(size.width), Height(size.height) {} bool operator==(const Rect& other) const { return X == other.X && Y == other.Y && Width == other.Width && Height == other.Height; } bool operator!=(const Rect& other) const { return !(*this == other); } bool Contains(float px, float py) const; bool Contains(Point p) const; Rect Intersect(const Rect& other) const; /* Rect Deflate(const Thickness& t) const; Rect Inflate(const Thickness& t) const; */ // unused, remove if not required by the time uiv2 is near complete }; struct Color { float r = 1.0f; float g = 1.0f; float b = 1.0f; float a = 1.0f; static Color FromRGB(float r, float g, float b, float a = 1.0f) { return Color{r, g, b, a}; } bool operator==(const Color& other) const { return r == other.r && g == other.g && b == other.b && a == other.a; } }; }