Click at a point in the window.
- ui: the UI to send the click to.
- x: horizontal position in points.
- y: vertical position in points.
ui := headless(.{ width = 320, height = 200 });
defer free_ui(*ui);
count := 0;
build := (n: *int) {
for column(.{ gap = 8, padding = 16 }) {
label(tprint("Clicked % times", n.*));
if button("Add") n.* += 1;
}
};
frame(*ui, *count, build);
button_node := find_label(*ui, "Add");
click_at(*ui, button_node.rect.x + 2, button_node.rect.y + 2);
frame(*ui, *count, build);
assert(count == 1);click_at :: (ui: *UI_State, x: float, y: float)
Click at a point in the window.
Parameters
- ui: *UI_State
- the UI to send the click to.
- x: float
- horizontal position in points.
- y: float
- vertical position in points.
ui := headless(.{ width = 320, height = 200 });
defer free_ui(*ui);
count := 0;
build := (n: *int) {
for column(.{ gap = 8, padding = 16 }) {
label(tprint("Clicked % times", n.*));
if button("Add") n.* += 1;
}
};
frame(*ui, *count, build);
button_node := find_label(*ui, "Add");
click_at(*ui, button_node.rect.x + 2, button_node.rect.y + 2);
frame(*ui, *count, build);
assert(count == 1);