cleaned up renderer

This commit is contained in:
Jorijn van der Graaf 2026-03-09 20:10:19 +01:00
commit d661c88ee2
58 changed files with 3030 additions and 4722 deletions

View file

@ -1,6 +1,6 @@
/*
Crafter®.Graphics
Copyright (C) 2025 Catcrafts®
Copyright (C) 2026 Catcrafts®
Catcrafts.net
This library is free software; you can redistribute it and/or
@ -27,35 +27,18 @@ import std;
using namespace Crafter;
MouseElement::MouseElement(Anchor anchor, WindowMouse& window) : Transform(anchor) {
MouseElement::MouseElement(Anchor2D anchor, Window& window) : Transform2D(anchor) {
window.mouseElements.push_back(this);
}
MouseElement::MouseElement(Anchor anchor) : Transform(anchor) {
MouseElement::MouseElement(Anchor2D anchor) : Transform2D(anchor) {
}
MouseElement::MouseElement(WindowMouse& window) : Transform({FractionalToMapped<std::uint32_t>(0), FractionalToMapped<std::uint32_t>(0), FractionalToMapped<std::uint32_t>(1), FractionalToMapped<std::uint32_t>(1), FractionalToMapped<std::uint32_t>(0), FractionalToMapped<std::uint32_t>(0), 0}) {
MouseElement::MouseElement(Window& window) : Transform2D({0, 0, 1, 1, 0, 0, 0}) {
window.mouseElements.push_back(this);
}
MouseElement::MouseElement() : Transform({FractionalToMapped<std::uint32_t>(0), FractionalToMapped<std::uint32_t>(0), FractionalToMapped<std::uint32_t>(1), FractionalToMapped<std::uint32_t>(1), FractionalToMapped<std::uint32_t>(0), FractionalToMapped<std::uint32_t>(0), 0}) {
MouseElement::MouseElement() : Transform2D({0, 0, 1, 1, 0, 0, 0}) {
}
void MouseElement::UpdatePosition(Window& window) {
window.ScaleMouse(*this);
window.ScaleElement(*this);
for(Transform* child : children) {
child->UpdatePosition(window, *this);
}
}
void MouseElement::UpdatePosition(Window& window, Transform& parent) {
window.ScaleMouse(*this, parent);
window.ScaleElement(*this, parent);
for(Transform* child : children) {
child->UpdatePosition(window, *this);
}
}