The retained value of type T stored on a node, created zeroed on first use and kept until the
node leaves the tree.
- node: the node that keeps the value.
- $T: the type stored. A node holding a value of another size has it replaced by a zeroed one.
ui := headless();
defer free_ui(*ui);
push_ui(*ui);
begin_frame(*ui);
node := widget(.LEAF, .CUSTOM, .{ width = 10, height = 10 }, #location());
clicks := state(node, int);
clicks.* += 1;
assert(state(node, int).* == 1);
end_frame(*ui);
pop_ui();state :: (node: *Node, $T: Type) -> *T
The retained value of type T stored on a node, created zeroed on first use and kept until the
node leaves the tree.
Parameters
- node: *Node
- the node that keeps the value.
- $T: Type
- the type stored. A node holding a value of another size has it replaced by a zeroed one.
Returns
- *T
ui := headless();
defer free_ui(*ui);
push_ui(*ui);
begin_frame(*ui);
node := widget(.LEAF, .CUSTOM, .{ width = 10, height = 10 }, #location());
clicks := state(node, int);
clicks.* += 1;
assert(state(node, int).* == 1);
end_frame(*ui);
pop_ui();