actually sensible classes

This commit is contained in:
Jorijn van der Graaf 2025-11-25 20:30:54 +01:00
commit c3b8761102
13 changed files with 128 additions and 152 deletions

View file

@ -18,8 +18,8 @@ License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
module Crafter.Graphics:UiElement_impl;
import :UiElement;
module Crafter.Graphics:Transform_impl;
import :Transform;
import :Window;
import :Types;
import :Font;
@ -27,6 +27,20 @@ import std;
using namespace Crafter;
Transform::Transform(void* element, std::int_fast32_t anchorX, std::int_fast32_t anchorY, std::uint_fast32_t relativeWidth, std::uint_fast32_t relativeHeight, std::int_fast32_t anchorOffsetX, std::int_fast32_t anchorOffsetY, std::int_fast32_t z, bool ignoreScaling) : element(element), anchorX(anchorX), anchorY(anchorY), relativeWidth(relativeWidth), relativeHeight(relativeHeight), anchorOffsetX(anchorOffsetX), anchorOffsetY(anchorOffsetY), z(z), ignoreScaling(ignoreScaling) {
Transform::Transform(std::int_fast32_t anchorX, std::int_fast32_t anchorY, std::uint_fast32_t relativeWidth, std::uint_fast32_t relativeHeight, std::int_fast32_t anchorOffsetX, std::int_fast32_t anchorOffsetY, std::int_fast32_t z, bool ignoreScaling) : anchorX(anchorX), anchorY(anchorY), relativeWidth(relativeWidth), relativeHeight(relativeHeight), anchorOffsetX(anchorOffsetX), anchorOffsetY(anchorOffsetY), z(z), ignoreScaling(ignoreScaling) {
}
void Transform::UpdatePosition(Window& window) {
window.ScaleElement(*this);
for(Transform* child : children) {
child->UpdatePosition(window, *this);
}
}
void Transform::UpdatePosition(Window& window, Transform& parent) {
window.ScaleElement(*this, parent);
for(Transform* child : children) {
child->UpdatePosition(window, *this);
}
}