import Crafter.Event; import Crafter.Graphics; import std; using namespace Crafter; int main() { WindowWayland window(1280, 720, "Hello Input!"); RenderingElement element( { FractionalToMapped(0), //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.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 }, OpaqueType::FullyOpaque ); Font font("inter.ttf"); std::string text = "testtttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt"; element.UpdatePosition(window); std::vector lines = element.ResizeText(window, text, 200, font, TextOverflowMode::Clip, TextScaleMode::Element); // anchor.width automatically scales with our text element.RenderText(window, lines, 200, {0,0,0,255}, font); window.elements.push_back(&element); window.Render(); window.StartSync(); }