I need help with implementing the logic of anchoring to a location aswell as putting things in relation to their parent. The rendering logic is completly fine. Its just the positions are not what i want and i dont know how to fix it.
gui::Rect2D rect2;
rect2.extent = { 200, 200 };
rect2.anchorParent = gui::Anchor::TopLeft;
rect2.anchorSelf = gui::Anchor::TopLeft;
rect2.offset = { 0, 0 };
mesh = rect2.refreshMesh(windowExtent);
StaticRenderable testRend2(mesh);
testRend2.draw();
gui::Rect2D rect3;
rect3.extent = { 100, 100 };
rect3.parent = &rect2;
rect3.anchorParent = gui::Anchor::MiddleMiddle;
rect3.anchorSelf = gui::Anchor::MiddleMiddle;
rect3.offset = { 0, 0 };
mesh = rect3.refreshMesh(windowExtent);
StaticRenderable testRend3(mesh);
testRend3.draw();
This is how i define my rectangles. I want to, at the end of it, have the parent anchor point overlap with the child anchor point, + any offset, for example: Trying to bind a childs MiddleLeft anchor point to the parents MiddleRight anchor point with 50 x offset, should cause 50 pixels of space between the two objects.
More stuff coming