added event example

This commit is contained in:
Jorijn van der Graaf 2025-11-10 21:31:06 +01:00
commit 6c3539fcd5
9 changed files with 249 additions and 31 deletions

View file

@ -9,8 +9,8 @@ HtmlElement* button = new HtmlElement("myButton"); //prevent destruction
int main() {
button->AddClickListener([](){
button->AddClickListener([](Crafter::MouseEvent event){
auto output = HtmlElement("output");
output.SetInnerHTML("Button was clicked!");
output.SetInnerHTML("Button was clicked at (" + std::to_string(event.clientX) + ", " + std::to_string(event.clientY) + ")!");
});
}