This commit is contained in:
Jorijn van der Graaf 2025-11-26 02:56:38 +01:00
commit 627ef13727
4 changed files with 45 additions and 31 deletions

View file

@ -6,7 +6,10 @@ using namespace Crafter;
int main() {
WindowWayland window(1280, 720, "Hello Input!");
Transform element(
RenderingElement element(
true,
2,
1,
FractionalToMapped(0.5), //anchorX: relative position where this elements x anchor (top-left) is placed to its parent x anchor
FractionalToMapped(0.5), //anchorY: relative position where this elements y anchor (top-left) is placed to its parent y anchor
FractionalToMapped(0.5), //relativeSizeX: the relative x size this element should be scaled to compared to its parent
@ -17,14 +20,11 @@ int main() {
false //ignoreScaling: wether this element ignores the scaling of the window, if true its size will be scaled according to the window scale
);
RenderingElement rendering(2, 1);
MouseElement mouse(window);
element.children.push_back(&rendering);
element.children.push_back(&mouse);
window.elements.push_back(&element);
rendering.buffer = {{255, 0, 0 ,255}, {0, 255, 0 ,255}};
element.buffer = {{255, 0, 0 ,255}, {0, 255, 0 ,255}};
element.UpdatePosition(window);
EventListener<MousePoint> clickListener(&mouse.onMouseLeftClick, [&mouse, &window](MousePoint point){