rendering element rewrite

This commit is contained in:
Jorijn van der Graaf 2025-12-28 00:05:03 +01:00
commit 3d40256bde
22 changed files with 799 additions and 795 deletions

View file

@ -23,19 +23,25 @@ import :Types;
export namespace Crafter {
class Window;
struct Anchor {
std::int_fast32_t x;
std::int_fast32_t y;
std::uint_fast32_t width;
std::uint_fast32_t height;
std::int_fast32_t offsetX;
std::int_fast32_t offsetY;
std::int_fast32_t z;
Anchor() = default;
Anchor(std::int_fast32_t x, std::int_fast32_t y, std::uint_fast32_t width, std::uint_fast32_t height, std::int_fast32_t offsetX, std::int_fast32_t offsetY, std::int_fast32_t z);
};
class Transform {
public:
std::int_fast32_t z;
std::int_fast32_t anchorX;
std::int_fast32_t anchorY;
std::int_fast32_t anchorOffsetX;
std::int_fast32_t anchorOffsetY;
std::uint_fast32_t relativeWidth;
std::uint_fast32_t relativeHeight;
Anchor anchor;
ScaleData scaled;
std::vector<Transform*> children;
Transform(std::int_fast32_t anchorX = FractionalToMapped(0.5), std::int_fast32_t anchorY = FractionalToMapped(0.5), std::uint_fast32_t relativeWidth = FractionalToMapped(1), std::uint_fast32_t relativeHeight = FractionalToMapped(1), std::int_fast32_t anchorOffsetX = FractionalToMapped(0.5), std::int_fast32_t anchorOffsetY = FractionalToMapped(0.5), std::int_fast32_t z = 0);
Transform(Anchor anchor);
Transform(Transform&) = delete;
Transform(Transform&&) = delete;
Transform& operator=(Transform&) = delete;
virtual ~Transform() = default;
virtual void UpdatePosition(Window& window);