Working on UI

This commit is contained in:
Vladislav Khorev committed 2026-05-30 22:27:09 +03:00
1 parent 9425f9b19a
commit a0550daf4b
6 files changed
+111 -23

No files matched your search

+30
View File
@@ -352,6 +352,36 @@ Typically called immediately after making a node visible. The node is automatica
---
## Touch / Click Priority
All `Button` and `TextButton` nodes in a layout are collected into a single ordered list during `collectButtonsAndSliders` (depth-first traversal of the node tree, which matches JSON declaration order). When a touch or mouse-down event arrives, the list is scanned **in reverse** — later-declared nodes are checked first — and the **first hit wins**. At most one element (button or textButton, regardless of type) fires per touch.
**Practical rule:** place background "catch-all" elements (e.g. a full-screen transparent exit button) **early** in the JSON, and foreground interactive elements **later**. The later-declared element will always win when they overlap.
```json
{
"type": "FrameLayout",
"children": [
{
"type": "Button",
"name": "phoneExitButton", // declared first → lowest priority
"width": "match_parent",
"height": "match_parent",
"textures": { "normal": "resources/transparent.png", ... }
},
{
"type": "TextButton",
"name": "chat2button", // declared later → wins over phoneExitButton
...
}
]
}
```
This behaviour is consistent across `Button` and `TextButton` — there is no inherent type priority, only declaration order matters.
---
## Animations
Animations can be defined on **Button** and **TextButton** nodes and started from C++ code. Each animation is a named sequence of steps.