actually sensible classes
This commit is contained in:
parent
9bbefbc021
commit
c3b8761102
13 changed files with 128 additions and 152 deletions
|
|
@ -27,24 +27,24 @@ import std;
|
|||
|
||||
using namespace Crafter;
|
||||
|
||||
MouseElement::MouseElement(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) : transform(this, anchorX, anchorY, relativeWidth, relativeHeight, anchorOffsetX, anchorOffsetY, z, ignoreScaling) {
|
||||
|
||||
MouseElement::MouseElement(WindowMouse& window, 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) : Transform(anchorX, anchorY, relativeWidth, relativeHeight, anchorOffsetX, anchorOffsetY, z, ignoreScaling) {
|
||||
window.mouseElements.push_back(this);
|
||||
}
|
||||
|
||||
MouseElement::MouseElement(Transform transform) : transform(transform) {
|
||||
MouseElement::MouseElement(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) : Transform(anchorX, anchorY, relativeWidth, relativeHeight, anchorOffsetX, anchorOffsetY, z, ignoreScaling) {
|
||||
|
||||
}
|
||||
|
||||
void MouseElement::UpdatePosition(Window& window) {
|
||||
window.ScaleMouse(transform);
|
||||
for(Transform* child : transform.children) {
|
||||
reinterpret_cast<MouseElement*>(child->element)->UpdatePosition(window, transform);
|
||||
window.ScaleMouse(*this);
|
||||
for(Transform* child : children) {
|
||||
child->UpdatePosition(window, *this);
|
||||
}
|
||||
}
|
||||
|
||||
void MouseElement::UpdatePosition(Window& window, Transform& parent) {
|
||||
window.ScaleMouse(transform, parent);
|
||||
for(Transform* child : transform.children) {
|
||||
reinterpret_cast<MouseElement*>(child->element)->UpdatePosition(window, transform);
|
||||
window.ScaleMouse(*this, parent);
|
||||
for(Transform* child : children) {
|
||||
child->UpdatePosition(window, *this);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue