/// Josh's User Interface Library /// A C++20 Library for creating, styling, and rendering of a UI/UX widgets. /// Developed and Maintained by Josh O'Leary @ Redacted Software. /// Special Thanks to William Tomasine II and Maxine Hayes. /// (c) 2024 Redacted Software /// This work is dedicated to the public domain. /// @file UDim.hpp /// @desc Universal Dimension Class /// @edit 2024-07-10 #pragma once namespace JUI { /// A coordinate system data type for user interfaces specifically. /// Contains a "Pixels" component and a "Scale" (0-1 float) component. /// @see UDim2.hpp class UDim { public: int Pixels; float Scale; public: UDim() : Pixels(0), Scale(0.f) {} UDim(int pixels, float scale) : Pixels(pixels), Scale(scale) {} UDim(const UDim& u) = default; public: UDim operator + (const UDim& rhs) const; UDim operator - (const UDim& rhs) const; UDim operator * (float rhs) const; UDim operator / (float rhs) const; }; namespace UDimLiterals { // special requirements on params for user-defined-literals? // https://en.cppreference.com/w/cpp/language/user_literal UDim operator ""_scale(long double sc); UDim operator ""_percent(unsigned long long pc); UDim operator ""_pixels(unsigned long long px); UDim operator ""_px(unsigned long long px); } using namespace UDimLiterals; }