rendering element rewrite

This commit is contained in:
Jorijn van der Graaf 2025-12-28 00:05:03 +01:00
commit 3d40256bde
22 changed files with 799 additions and 795 deletions

View file

@ -6,24 +6,34 @@ using namespace Crafter;
int main() {
WindowWayland window(1280, 720, "Hello Input!");
RenderingElement element(
RenderingElement<true, true, false> element(
{
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
FractionalToMapped(0.5), //relativeSizeY: the relative y size this element should be scaled to compared to its parent
FractionalToMapped(0.5), //anchorOffsetX: the amount this element's anchor should be offset from the top left corner (0.5 to in the middle)
FractionalToMapped(0.5), //anchorOffsetY: the amount this element's anchor should be offset from the top left corner (0.5 to place it in the middle)
0 //z: this elements Z position
},
OpaqueType::FullyOpaque,
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
FractionalToMapped(0.5), //relativeSizeY: the relative y size this element should be scaled to compared to its parent
FractionalToMapped(0.5), //anchorOffsetX: the amount this element's anchor should be offset from the top left corner (0.5 to in the middle)
FractionalToMapped(0.5), //anchorOffsetY: the amount this element's anchor should be offset from the top left corner (0.5 to place it in the middle)
0, //z: this elements Z position
1
);
MouseElement mouse(window);
MouseElement mouse({
FractionalToMapped(0), //anchorX: relative position where this elements x anchor (top-left) is placed to its parent x anchor
FractionalToMapped(0), //anchorY: relative position where this elements y anchor (top-left) is placed to its parent y anchor
FractionalToMapped(1), //relativeSizeX: the relative x size this element should be scaled to compared to its parent
FractionalToMapped(1), //relativeSizeY: the relative y size this element should be scaled to compared to its parent
FractionalToMapped(0), //anchorOffsetX: the amount this element's anchor should be offset from the top left corner (0.5 to in the middle)
FractionalToMapped(0), //anchorOffsetY: the amount this element's anchor should be offset from the top left corner (0.5 to place it in the middle)
0 //z: this elements Z position
}, window);
element.children.push_back(&mouse);
window.elements.push_back(&element);
element.buffer = {{255, 0, 0 ,255}, {0, 255, 0 ,255}};
element.scalingBuffer = {{255, 0, 0 ,255}, {0, 255, 0 ,255}};
element.UpdatePosition(window);
EventListener<MousePoint> clickListener(&mouse.onMouseLeftClick, [&mouse, &window](MousePoint point){

View file

@ -7,9 +7,10 @@
"dependencies": [
{
"path":"../../project.json",
"configuration":"lib-wayland"
"configuration":"lib-wayland-debug"
}
]
],
"debug": true
}
]
}