Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

fix(ui): theme roles persist into prefabs + settled gears re-arm + scroll/list correctness

esengine5aa9da92020f
diff --git a/desktop/src/engine/schema.ts b/desktop/src/engine/schema.ts
index 5864c5f15..5abc6362f 100644
--- a/desktop/src/engine/schema.ts
+++ b/desktop/src/engine/schema.ts
@@ -95,6 +95,18 @@ const COMPONENT_CATEGORY: Record<string, string> = {
TilemapLayer: 'Rendering',
Video: 'Rendering',
Canvas: 'UI',
+ UINode: 'UI',
+ UIVisual: 'UI',
+ UIMask: 'UI',
+ FlexContainer: 'UI',
+ SafeArea: 'UI',
+ Interactable: 'UI',
+ Focusable: 'UI',
+ Draggable: 'UI',
+ TextInput: 'UI',
+ ThemeStyle: 'UI',
+ UIController: 'UI',
+ UIGear: 'UI',
SpineAnimation: 'Animation',
ParticleEmitter: 'Effects',
RigidBody: 'Physics',
@@ -621,8 +633,9 @@ export function modelAddableComponentEntries(
const present = new Set(entity.components.map((c) => c.type));
const userNames = new Set(getUserComponents().keys());
const out: Array<{ name: string; label: string; category: string }> = [];
- for (const [name] of getAllRegisteredComponents()) {
+ for (const [name, def] of getAllRegisteredComponents()) {
if (HIDDEN_COMPONENTS.has(name) || name === 'Transform' || present.has(name)) continue;
+ if (def.transient) continue; // runtime-only state is never authorable
out.push({ name, label: prettyLabel(name), category: componentCategory(name, userNames.has(name)) });
}
for (const name of userSchemas.keys()) {
diff --git a/sdk/etc/index.api.md b/sdk/etc/index.api.md
index 89d7c951c..21fb5a2f7 100644
--- a/sdk/etc/index.api.md
+++ b/sdk/etc/index.api.md
@@ -1,11 +1,11 @@
# API surface — esengine/index
<!-- Generated by tools/api-surface.mjs — do not edit. Run --update to accept changes. -->
-Symbols: 1206 stable · 17 beta · 1 deprecated
+Symbols: 1204 stable · 17 beta · 1 deprecated
## ABI_LAYOUT_HASH — const
```
-"f9191aeae848066e"
+"bde213b560e9ce4c"
```
## ANCHOR_AXES — const
@@ -225,11 +225,6 @@ name: string
type: "animFrames"
```
-## AnimOverride — const
-```
-{ readonly POS_X: 1; readonly POS_Y: 2; readonly ROT_Z: 4; readonly SCALE_X: 8; readonly SCALE_Y: 16; }
-```
-
## AnimationPlugin — class
```
build: (app: App) => void
@@ -2111,6 +2106,7 @@ getSpritePtr: (registry: CppRegistry, entity: number) => number
getTransformPtr: (registry: CppRegistry, entity: number) => number
getUINodeComputedHeight: ((registry: CppRegistry, entity: number) => number) | undefined
getUINodeComputedWidth: ((registry: CppRegistry, entity: number) => number) | undefined
+getUINodeHiddenInTree: ((registry: CppRegistry, entity: number) => boolean) | undefined
getVelocityPtr: (registry: CppRegistry, entity: number) => number
gl_checkErrors: (context: string) => number
gl_enableErrorCheck: (enabled: boolean) => void
@@ -2250,8 +2246,6 @@ uiHitTest_update: (registry: CppRegistry, mouseWorldX: number, mouseWorldY: numb
uiLayout_update: (registry: CppRegistry, camLeft: number, camBottom: number, camRight: number, camTop: number) => void
uiNode_computedHeight: (registry: CppRegistry, entity: number) => number
uiNode_computedWidth: (registry: CppRegistry, entity: number) => number
-uiRect_clearAnimOverrides: (registry: CppRegistry) => void
-uiRect_setAnimOverride: (registry: CppRegistry, entity: number, flags: number) => void
uiRenderOrder_update: (registry: CppRegistry) => void
uiTree_markAllDirty: () => void
uiTree_markDirty: (entity: number) => void
@@ -2455,11 +2449,6 @@ tooltip: string | undefined
unit: string | undefined
```
-## FillDirection — type
-```
-(typeof FillDirection)[keyof typeof FillDirection]
-```
-
## FillMethod — enum
```
Horizontal = 0
@@ -6597,7 +6586,7 @@ background: UIVisualInit | undefined
check: { node?: UINodeInit; color?: Color; sprite?: number; } | undefined
disabled: boolean | undefined
events: UIEventQueue
-interactionStates: Record<string, ButtonStateVisual>
+interactionStates: Record<string, ButtonStateVisual> | undefined
isOn: boolean | undefined
node: UINodeInit | undefined
onChange: ((isOn: boolean, entity: Entity) => void) | undefined
@@ -6851,6 +6840,12 @@ ComponentDef<UIControllerData>
controllers: ControllerState[]
```
+## UIDisplay — enum
+```
+Flex = 0
+None = 1
+```
+
## UIEntityInit — interface
```
node: UINodeInit | undefined
@@ -6958,8 +6953,6 @@ BuiltinComponentDef<UIMaskData>
## UIMaskData — interface
```
enabled: boolean
-inverted: boolean
-maskTexture: number
mode: MaskMode
```
@@ -8480,11 +8473,6 @@ Logger
(value: unknown): value is string
```
-## makeInteractable — function
-```
-(world: World, entity: Entity): void
-```
-
## makeLosCheck — function
```
(physics: Physics): LosCheck
diff --git a/sdk/etc/index.node.api.md b/sdk/etc/index.node.api.md
index 84ca79591..9ef2b4e79 100644
--- a/sdk/etc/index.node.api.md
+++ b/sdk/etc/index.node.api.md
@@ -1,7 +1,7 @@
# API surface — esengine/index.node
<!-- Generated by tools/api-surface.mjs — do not edit. Run --update to accept changes. -->
-Symbols: 1205 stable · 19 beta · 1 deprecated
+Symbols: 1203 stable · 19 beta · 1 deprecated
## ANCHOR_AXES — const
```
@@ -220,11 +220,6 @@ name: string
type: "animFrames"
```
-## AnimOverride — const
-```
-{ readonly POS_X: 1; readonly POS_Y: 2; readonly ROT_Z: 4; readonly SCALE_X: 8; readonly SCALE_Y: 16; }
-```
-
## AnimationPlugin — class
```
build: (app: App) => void
@@ -2106,6 +2101,7 @@ getSpritePtr: (registry: CppRegistry, entity: number) => number
getTransformPtr: (registry: CppRegistry, entity: number) => number
getUINodeComputedHeight: ((registry: CppRegistry, entity: number) => number) | undefined
getUINodeComputedWidth: ((registry: CppRegistry, entity: number) => number) | undefined
+getUINodeHiddenInTree: ((registry: CppRegistry, entity: number) => boolean) | undefined
getVelocityPtr: (registry: CppRegistry, entity: number) => number
gl_checkErrors: (context: string) => number
gl_enableErrorCheck: (enabled: boolean) => void
@@ -2245,8 +2241,6 @@ uiHitTest_update: (registry: CppRegistry, mouseWorldX: number, mouseWorldY: numb
uiLayout_update: (registry: CppRegistry, camLeft: number, camBottom: number, camRight: number, camTop: number) => void
uiNode_computedHeight: (registry: CppRegistry, entity: number) => number
uiNode_computedWidth: (registry: CppRegistry, entity: number) => number
-uiRect_clearAnimOverrides: (registry: CppRegistry) => void
-uiRect_setAnimOverride: (registry: CppRegistry, entity: number, flags: number) => void
uiRenderOrder_update: (registry: CppRegistry) => void
uiTree_markAllDirty: () => void
uiTree_markDirty: (entity: number) => void
@@ -2450,11 +2444,6 @@ tooltip: string | undefined
unit: string | undefined
```
-## FillDirection — type
-```
-(typeof FillDirection)[keyof typeof FillDirection]
-```
-
## FillMethod — enum
```
Horizontal = 0
@@ -6592,7 +6581,7 @@ background: UIVisualInit | undefined
check: { node?: UINodeInit; color?: Color; sprite?: number; } | undefined
disabled: boolean | undefined
events: UIEventQueue
-interactionStates: Record<string, ButtonStateVisual>
+interactionStates: Record<string, ButtonStateVisual> | undefined
isOn: boolean | undefined
node: UINodeInit | undefined
onChange: ((isOn: boolean, entity: Entity) => void) | undefined
@@ -6846,6 +6835,12 @@ ComponentDef<UIControllerData>
controllers: ControllerState[]
```
+## UIDisplay — enum
+```
+Flex = 0
+None = 1
+```
+
## UIEntityInit — interface
```
node: UINodeInit | undefined
@@ -6953,8 +6948,6 @@ BuiltinComponentDef<UIMaskData>
## UIMaskData — interface
```
enabled: boolean
-inverted: boolean
-maskTexture: number
mode: MaskMode
```
@@ -8480,11 +8473,6 @@ Logger
(value: unknown): value is string
```
-## makeInteractable — function
-```
-(world: World, entity: Entity): void
-```
-
## makeLosCheck — function
```
(physics: Physics): LosCheck
diff --git a/sdk/etc/wasm.api.md b/sdk/etc/wasm.api.md
index dfc06a934..859cc5143 100644
--- a/sdk/etc/wasm.api.md
+++ b/sdk/etc/wasm.api.md
@@ -219,6 +219,7 @@ getSpritePtr: (registry: CppRegistry, entity: number) => number
getTransformPtr: (registry: CppRegistry, entity: number) => number
getUINodeComputedHeight: ((registry: CppRegistry, entity: number) => number) | undefined
getUINodeComputedWidth: ((registry: CppRegistry, entity: number) => number) | undefined
+getUINodeHiddenInTree: ((registry: CppRegistry, entity: number) => boolean) | undefined
getVelocityPtr: (registry: CppRegistry, entity: number) => number
gl_checkErrors: (context: string) => number
gl_enableErrorCheck: (enabled: boolean) => void
@@ -358,8 +359,6 @@ uiHitTest_update: (registry: CppRegistry, mouseWorldX: number, mouseWorldY: numb
uiLayout_update: (registry: CppRegistry, camLeft: number, camBottom: number, camRight: number, camTop: number) => void
uiNode_computedHeight: (registry: CppRegistry, entity: number) => number
uiNode_computedWidth: (registry: CppRegistry, entity: number) => number
-uiRect_clearAnimOverrides: (registry: CppRegistry) => void
-uiRect_setAnimOverride: (registry: CppRegistry, entity: number, flags: number) => void
uiRenderOrder_update: (registry: CppRegistry) => void
uiTree_markAllDirty: () => void
uiTree_markDirty: (entity: number) => void
diff --git a/sdk/src/ui/behavior/plugin.ts b/sdk/src/ui/behavior/plugin.ts
index ed757ff58..f77281f9c 100644
--- a/sdk/src/ui/behavior/plugin.ts
+++ b/sdk/src/ui/behavior/plugin.ts
@@ -113,11 +113,24 @@ export class UIBehaviorPlugin implements Plugin {
const dx = input.scrollDeltaX;
const dy = input.scrollDeltaY;
if (dx === 0 && dy === 0) return;
- for (const [entity, container] of scrollContainers.entries()) {
+ // Deepest hovered container wins (same arbitration as drag
+ // scrolling) — a wheel over a nested list must not scroll its
+ // ancestor too.
+ let best: Entity | null = null;
+ let bestDepth = -1;
+ for (const [entity] of scrollContainers.entries()) {
if (!world.has(entity as Entity, UIInteraction)) continue;
const ui = world.get(entity as Entity, UIInteraction) as UIInteractionData;
if (!ui.hovered) continue;
- dynamics.get(entity as Entity)?.stop(); // wheel takes over from a fling
+ const depth = getEntityDepth(world, entity as Entity);
+ if (depth > bestDepth) {
+ bestDepth = depth;
+ best = entity as Entity;
+ }
+ }
+ if (best !== null) {
+ const container = scrollContainers.get(best)!;
+ dynamics.get(best)?.stop(); // wheel takes over from a fling
const speed = container.getWheelSpeed();
container.scrollBy({ x: dx * speed, y: dy * speed });
}
diff --git a/sdk/src/ui/collection/list-view.ts b/sdk/src/ui/collection/list-view.ts
index c22bfcc9d..a00cc318c 100644
--- a/sdk/src/ui/collection/list-view.ts
+++ b/sdk/src/ui/collection/list-view.ts
@@ -178,10 +178,19 @@ export class ListView<T = unknown> {
const existing = this.mounted_.get(i);
const itemType = this.dataSource_.getItemType?.(i) ?? 'default';
+ // A mounted entity is only reusable if its template type still
+ // matches — after a data reset the same index can change type, and
+ // binding a new type's data to the old template's entity corrupts it.
+ if (existing && existing.itemType !== itemType) {
+ this.pool_.release(existing.itemType, existing.entity);
+ this.mounted_.delete(i);
+ }
+
let entity: Entity;
- if (existing) {
+ const reusable = this.mounted_.get(i);
+ if (reusable) {
// Item already mounted; bind again in case data updated.
- entity = existing.entity;
+ entity = reusable.entity;
} else {
if (!this.pool_.hasTemplate(itemType)) {
log.warn('ui', `ListView: No template for item type "${itemType}" at index ${i}`);
diff --git a/sdk/src/ui/controller/gear-apply.ts b/sdk/src/ui/controller/gear-apply.ts
index 903571443..e836044f0 100644
--- a/sdk/src/ui/controller/gear-apply.ts
+++ b/sdk/src/ui/controller/gear-apply.ts
@@ -175,7 +175,7 @@ interface BindingTx {
* (stop writing) until their page changes, so a static UI costs nothing per frame.
*/
export function createGearApplySystem(world: World): SystemDef {
- const tracker = new EntityStateMap<Array<BindingTx | null>>();
+ const tracker = new EntityStateMap<{ ref: unknown; txs: Array<BindingTx | null> }>();
return defineSystem([Res(Time)], (time: TimeData) => {
const dt = time.delta;
@@ -186,11 +186,15 @@ export function createGearApplySystem(world: World): SystemDef {
const gear = world.get(e, UIGear) as UIGearData;
const bindings = gear.bindings;
- let txs = tracker.get(e);
- if (!txs || txs.length !== bindings.length) {
- txs = bindings.map(() => null);
- tracker.set(e, txs);
+ // Keyed on the bindings array's identity: any rewrite (theme
+ // re-resolution, editor gear authoring) swaps in a new array, which
+ // must re-arm settled transitions or the current page never repaints.
+ let entry = tracker.get(e);
+ if (!entry || entry.ref !== bindings || entry.txs.length !== bindings.length) {
+ entry = { ref: bindings, txs: bindings.map(() => null) };
+ tracker.set(e, entry);
}
+ const txs = entry.txs;
for (let i = 0; i < bindings.length; i++) {
const b = bindings[i];
diff --git a/sdk/src/ui/input/draggable.ts b/sdk/src/ui/input/draggable.ts
index c001ce99b..cd8d6f7fb 100644
--- a/sdk/src/ui/input/draggable.ts
+++ b/sdk/src/ui/input/draggable.ts
@@ -34,6 +34,8 @@ export interface DragStateData {
pointerStartWorld: { x: number; y: number };
}
+// Per-frame drag state written by the drag system — never authored, never
+// persisted.
export const DragState = defineComponent<DragStateData>('DragState', {
isDragging: false,
startWorldPos: { x: 0, y: 0 },
@@ -41,4 +43,4 @@ export const DragState = defineComponent<DragStateData>('DragState', {
deltaWorld: { x: 0, y: 0 },
totalDeltaWorld: { x: 0, y: 0 },
pointerStartWorld: { x: 0, y: 0 },
-});
+}, { transient: true });
diff --git a/sdk/src/ui/input/interactable.ts b/sdk/src/ui/input/interactable.ts
index b7dfe524f..8da4364d2 100644
--- a/sdk/src/ui/input/interactable.ts
+++ b/sdk/src/ui/input/interactable.ts
@@ -4,7 +4,7 @@
* @file ui/input/interactable.ts
* @brief Input concept primitives: Interactable (hit-test gate config) and
* UIInteraction (per-frame pointer state written by the hit-test
- * system). Foundation that the behavior FSM + drag/focus build on.
+ * system). Foundation that controllers + drag/focus build on.
*/
import { defineBuiltin } from '../../component';
@@ -27,9 +27,11 @@ export interface UIInteractionData {
justReleased: boolean;
}
+// Per-frame pointer state written by the hit-test system — never authored,
+// never persisted. The hit-test getOrEmplaces it on demand.
export const UIInteraction = defineBuiltin<UIInteractionData>('UIInteraction', {
hovered: false,
pressed: false,
justPressed: false,
justReleased: false,
-});
+}, { transient: true });
diff --git a/sdk/src/ui/theme/theme-style.ts b/sdk/src/ui/theme/theme-style.ts
index 87f9d45ec..9ddb3b2c1 100644
--- a/sdk/src/ui/theme/theme-style.ts
+++ b/sdk/src/ui/theme/theme-style.ts
@@ -9,8 +9,9 @@
* `UIVisual`/`Text`/their `$interaction` colour gears at construction, so without recording the
* *role* there is no way to re-resolve them when the theme changes. A widget tags
* the entities it themes (via {@link markThemed}); `applyThemeToWorld` re-resolves
- * the tags against the active theme. Not serialized — it lives only on
- * code-constructed widgets.
+ * the tags against the active theme. Role tags are authoring data and persist
+ * into prefabs/scenes — an editor-placed widget must re-theme like a
+ * code-constructed one.
*/
import { defineComponent } from '../../component';
import type { World } from '../../world';
@@ -29,15 +30,12 @@ export interface ThemeStyleData {
states?: Record<string, ColorRole>;
}
-// Runtime-only: a widget's theme-role tags are re-derived from code on every
-// construct, never persisted — so it stays out of scenes and prefabs. The default
-// DECLARES the fields (even though all are optional): `insert` validates data
-// against the schema's keys, so an empty default would reject every role a widget
-// tags (e.g. a dialog's `{ visual: 'backdrop' }`).
+// The default DECLARES the fields (even though all are optional): `insert`
+// validates data against the schema's keys, so an empty default would reject
+// every role a widget tags (e.g. a dialog's `{ visual: 'backdrop' }`).
export const ThemeStyle = defineComponent<ThemeStyleData>(
'ThemeStyle',
{ visual: undefined, text: undefined, states: {} },
- { transient: true },
);
/** Tag `entity` so the active theme's colors re-resolve onto it (see
diff --git a/sdk/src/ui/widgets/dropdown.ts b/sdk/src/ui/widgets/dropdown.ts
index 17bd226cf..69faeb3f1 100644
--- a/sdk/src/ui/widgets/dropdown.ts
+++ b/sdk/src/ui/widgets/dropdown.ts
@@ -98,11 +98,6 @@ export function createDropdown<T>(opts: DropdownOptions<T>): DropdownHandle<T> {
hover: opts.buttonStates?.hover ?? c.controlHover,
pressed: opts.buttonStates?.pressed ?? c.controlActive,
};
- const optColors = {
- normal: opts.optionStates?.normal ?? c.control,
- hover: opts.optionStates?.hover ?? c.primaryHover,
- pressed: opts.optionStates?.pressed ?? c.primaryActive,
- };
// Button root.
const button = spawnUIEntity({
@@ -137,6 +132,15 @@ export function createDropdown<T>(opts: DropdownOptions<T>): DropdownHandle<T> {
if (popupPanel) return;
const totalHeight = opts.options.length * optionHeight;
+ // Resolve theme colors at open time — the popup is rebuilt per open, so a
+ // construction-time capture would pin the theme active back then.
+ const t = themeColors();
+ const optColors = {
+ normal: opts.optionStates?.normal ?? t.control,
+ hover: opts.optionStates?.hover ?? t.primaryHover,
+ pressed: opts.optionStates?.pressed ?? t.primaryActive,
+ };
+
popupPanel = spawnUIEntity({
world,
parent: button,
@@ -148,18 +152,23 @@ export function createDropdown<T>(opts: DropdownOptions<T>): DropdownHandle<T> {
insetTop: percent(100),
height: px(totalHeight),
},
- visual: opts.popupVisual ?? { color: c.surfaceElevated },
+ visual: opts.popupVisual ?? { color: t.surfaceElevated },
});
+ if (!opts.popupVisual) markThemed(world, popupPanel, { visual: 'surfaceElevated' });
for (let i = 0; i < opts.options.length; i++) {
const index = i;
- const row = spawnOptionRow(index);
+ const row = spawnOptionRow(index, optColors, t.text);
const off = events.on(row, UIEventType.Click, () => selectAndClose(index));
optionUnsubs.push(off);
}
}
- function spawnOptionRow(index: number): Entity {
+ function spawnOptionRow(
+ index: number,
+ optColors: { normal: Color; hover: Color; pressed: Color },
+ textColor: Color,
+ ): Entity {
const row = spawnUIEntity({
world,
parent: popupPanel!,
@@ -176,13 +185,17 @@ export function createDropdown<T>(opts: DropdownOptions<T>): DropdownHandle<T> {
world.insert(row, Interactable, { enabled: true, blockRaycast: true, raycastTarget: true });
world.insert(row, UIInteraction, INTERACTION_DEFAULT);
addInteractionStates(world, row, optColors);
+ if (opts.optionStates === undefined) {
+ markThemed(world, row, { states: { normal: 'control', hover: 'primaryHover', pressed: 'primaryActive' } });
+ }
- spawnUIEntity({
+ const rowLabel = spawnUIEntity({
world,
parent: row,
node: { fill: true },
- text: { content: labelOf(opts.options[index]!, index) },
+ text: { content: labelOf(opts.options[index]!, index), color: textColor },
});
+ markThemed(world, rowLabel, { text: 'text' });
return row;
}
diff --git a/sdk/src/ui/widgets/prefabs/Button.esprefab b/sdk/src/ui/widgets/prefabs/Button.esprefab
index 242785c80..286e57f2e 100644
--- a/sdk/src/ui/widgets/prefabs/Button.esprefab
+++ b/sdk/src/ui/widgets/prefabs/Button.esprefab
@@ -52,6 +52,7 @@
"type": "UINode",
"data": {
"position": 0,
+ "display": 0,
"width": {
"value": 140,
"unit": 0
@@ -161,15 +162,6 @@
"raycastTarget": true
}
},
- {
- "type": "UIInteraction",
- "data": {
- "hovered": false,
- "pressed": false,
- "justPressed": false,
- "justReleased": false
- }
- },
{
"type": "UIController",
"data": {
@@ -213,11 +205,28 @@
"g": 0.18,
"b": 0.22,
"a": 1
+ },
+ "disabled": {
+ "r": 0.22,
+ "g": 0.22,
+ "b": 0.26,
+ "a": 0.5
}
}
}
]
}
+ },
+ {
+ "type": "ThemeStyle",
+ "data": {
+ "states": {
+ "normal": "control",
+ "hover": "controlHover",
+ "pressed": "controlActive",
+ "disabled": "control"
+ }
+ }
}
],
"visible": true
@@ -269,6 +278,7 @@
"type": "UINode",
"data": {
"position": 1,
+ "display": 0,
"width": {
"value": 0,
"unit": 2
@@ -342,9 +352,9 @@
"fontFamily": "Arial",
"fontSize": 14,
"color": {
- "r": 1,
- "g": 1,
- "b": 1,
+ "r": 0.92,
+ "g": 0.92,
+ "b": 0.94,
"a": 1
},
"align": 1,
@@ -374,6 +384,12 @@
"renderMode": 0,
"enabled": true
}
+ },
+ {
+ "type": "ThemeStyle",
+ "data": {
+ "text": "text"
+ }
}
],
"visible": true
diff --git a/sdk/src/ui/widgets/prefabs/Dropdown.esprefab b/sdk/src/ui/widgets/prefabs/Dropdown.esprefab
index 284a95f94..67ab411dc 100644
--- a/sdk/src/ui/widgets/prefabs/Dropdown.esprefab
+++ b/sdk/src/ui/widgets/prefabs/Dropdown.esprefab
@@ -52,6 +52,7 @@
"type": "UINode",
"data": {
"position": 0,
+ "display": 0,
"width": {
"value": 150,
"unit": 0
@@ -161,15 +162,6 @@
"raycastTarget": true
}
},
- {
- "type": "UIInteraction",
- "data": {
- "hovered": false,
- "pressed": false,
- "justPressed": false,
- "justReleased": false
- }
- },
{
"type": "UIController",
"data": {
@@ -217,6 +209,16 @@
}
]
}
+ },
+ {
+ "type": "ThemeStyle",
+ "data": {
+ "states": {
+ "normal": "control",
+ "hover": "controlHover",
+ "pressed": "controlActive"
+ }
+ }
}
],
"visible": true
@@ -268,6 +270,7 @@
"type": "UINode",
"data": {
"position": 1,
+ "display": 0,
"width": {
"value": 0,
"unit": 2
@@ -373,6 +376,12 @@
"renderMode": 0,
"enabled": true
}
+ },
+ {
+ "type": "ThemeStyle",
+ "data": {
+ "text": "text"
+ }
}
],
"visible": true
diff --git a/sdk/src/ui/widgets/prefabs/ListView.esprefab b/sdk/src/ui/widgets/prefabs/ListView.esprefab
index a0a804975..e0e4e1a68 100644
--- a/sdk/src/ui/widgets/prefabs/ListView.esprefab
+++ b/sdk/src/ui/widgets/prefabs/ListView.esprefab
@@ -52,6 +52,7 @@
"type": "UINode",
"data": {
"position": 0,
+ "display": 0,
"width": {
"value": 240,
"unit": 0
@@ -153,13 +154,17 @@
"enabled": true
}
},
+ {
+ "type": "ThemeStyle",
+ "data": {
+ "visual": "control"
+ }
+ },
{
"type": "UIMask",
"data": {
"enabled": true,
- "mode": 0,
- "maskTexture": 0,
- "inverted": false
+ "mode": 0
}
},
{
@@ -169,15 +174,6 @@
"blockRaycast": true,
"raycastTarget": true
}
- },
- {
- "type": "UIInteraction",
- "data": {
- "hovered": false,
- "pressed": false,
- "justPressed": false,
- "justReleased": false
- }
}
],
"visible": true
@@ -229,6 +225,7 @@
"type": "UINode",
"data": {
"position": 1,
+ "display": 0,
"width": {
"value": 0,
"unit": 2
@@ -302,9 +299,9 @@
"fontFamily": "Arial",
"fontSize": 14,
"color": {
- "r": 1,
- "g": 1,
- "b": 1,
+ "r": 0.92,
+ "g": 0.92,
+ "b": 0.94,
"a": 1
},
"align": 1,
@@ -334,6 +331,12 @@
"renderMode": 0,
"enabled": true
}
+ },
+ {
+ "type": "ThemeStyle",
+ "data": {
+ "text": "text"
+ }
}
],
"visible": true
diff --git a/sdk/src/ui/widgets/prefabs/Progress.esprefab b/sdk/src/ui/widgets/prefabs/Progress.esprefab
index f17f8b460..9a8441f54 100644
--- a/sdk/src/ui/widgets/prefabs/Progress.esprefab
+++ b/sdk/src/ui/widgets/prefabs/Progress.esprefab
@@ -52,6 +52,7 @@
"type": "UINode",
"data": {
"position": 0,
+ "display": 0,
"width": {
"value": 200,
"unit": 0
@@ -152,6 +153,12 @@
"material": 0,
"enabled": true
}
+ },
+ {
+ "type": "ThemeStyle",
+ "data": {
+ "visual": "track"
+ }
}
],
"visible": true
@@ -203,6 +210,7 @@
"type": "UINode",
"data": {
"position": 1,
+ "display": 0,
"width": {
"value": 0,
"unit": 2
@@ -303,6 +311,12 @@
"material": 0,
"enabled": true
}
+ },
+ {
+ "type": "ThemeStyle",
+ "data": {
+ "visual": "primary"
+ }
}
],
"visible": true
diff --git a/sdk/src/ui/widgets/prefabs/Slider.esprefab b/sdk/src/ui/widgets/prefabs/Slider.esprefab
index c87b79cfe..9fc07d513 100644
--- a/sdk/src/ui/widgets/prefabs/Slider.esprefab
+++ b/sdk/src/ui/widgets/prefabs/Slider.esprefab
@@ -53,6 +53,7 @@
"type": "UINode",
"data": {
"position": 0,
+ "display": 0,
"width": {
"value": 200,
"unit": 0
@@ -153,6 +154,12 @@
"material": 0,
"enabled": true
}
+ },
+ {
+ "type": "ThemeStyle",
+ "data": {
+ "visual": "track"
+ }
}
],
"visible": true
@@ -204,6 +211,7 @@
"type": "UINode",
"data": {
"position": 1,
+ "display": 0,
"width": {
"value": 14,
"unit": 0
@@ -304,6 +312,12 @@
"material": 0,
"enabled": true
}
+ },
+ {
+ "type": "ThemeStyle",
+ "data": {
+ "visual": "onPrimary"
+ }
}
],
"visible": true
@@ -355,6 +369,7 @@
"type": "UINode",
"data": {
"position": 1,
+ "display": 0,
"width": {
"value": 0,
"unit": 2
@@ -455,6 +470,12 @@
"material": 0,
"enabled": true
}
+ },
+ {
+ "type": "ThemeStyle",
+ "data": {
+ "visual": "primary"
+ }
}
],
"visible": true
diff --git a/sdk/src/ui/widgets/prefabs/Toggle.esprefab b/sdk/src/ui/widgets/prefabs/Toggle.esprefab
index aeb0cbc5f..2a5850cc4 100644
--- a/sdk/src/ui/widgets/prefabs/Toggle.esprefab
+++ b/sdk/src/ui/widgets/prefabs/Toggle.esprefab
@@ -52,6 +52,7 @@
"type": "UINode",
"data": {
"position": 0,
+ "display": 0,
"width": {
"value": 28,
"unit": 0
@@ -123,9 +124,9 @@
"visualType": 1,
"texture": 0,
"color": {
- "r": 0.22,
- "g": 0.22,
- "b": 0.26,
+ "r": 1,
+ "g": 1,
+ "b": 1,
"a": 1
},
"uvOffset": {
@@ -161,15 +162,6 @@
"raycastTarget": true
}
},
- {
- "type": "UIInteraction",
- "data": {
- "hovered": false,
- "pressed": false,
- "justPressed": false,
- "justReleased": false
- }
- },
{
"type": "UIController",
"data": {
@@ -213,11 +205,28 @@
"g": 0.18,
"b": 0.22,
"a": 1
+ },
+ "disabled": {
+ "r": 0.22,
+ "g": 0.22,
+ "b": 0.26,
+ "a": 0.5
}
}
}
]
}
+ },
+ {
+ "type": "ThemeStyle",
+ "data": {
+ "states": {
+ "normal": "control",
+ "hover": "controlHover",
+ "pressed": "controlActive",
+ "disabled": "control"
+ }
+ }
}
],
"visible": true
@@ -269,6 +278,7 @@
"type": "UINode",
"data": {
"position": 1,
+ "display": 0,
"width": {
"value": 0,
"unit": 2
@@ -369,6 +379,12 @@
"material": 0,
"enabled": true
}
+ },
+ {
+ "type": "ThemeStyle",
+ "data": {
+ "visual": "primary"
+ }
}
],
"visible": true
diff --git a/sdk/src/ui/widgets/prefabs/generated.ts b/sdk/src/ui/widgets/prefabs/generated.ts
index 915075791..81cacbaaf 100644
--- a/sdk/src/ui/widgets/prefabs/generated.ts
+++ b/sdk/src/ui/widgets/prefabs/generated.ts
@@ -56,6 +56,7 @@ export const BUILTIN_UI_PREFABS: Record<string, PrefabData> = {
"type": "UINode",
"data": {
"position": 0,
+ "display": 0,
"width": {
"value": 140,
"unit": 0
@@ -165,15 +166,6 @@ export const BUILTIN_UI_PREFABS: Record<string, PrefabData> = {
"raycastTarget": true
}
},
- {
- "type": "UIInteraction",
- "data": {
- "hovered": false,
- "pressed": false,
- "justPressed": false,
- "justReleased": false
- }
- },
{
"type": "UIController",
"data": {
@@ -217,11 +209,28 @@ export const BUILTIN_UI_PREFABS: Record<string, PrefabData> = {
"g": 0.18,
"b": 0.22,
"a": 1
+ },
+ "disabled": {
+ "r": 0.22,
+ "g": 0.22,
+ "b": 0.26,
+ "a": 0.5
}
}
}
]
}
+ },
+ {
+ "type": "ThemeStyle",
+ "data": {
+ "states": {
+ "normal": "control",
+ "hover": "controlHover",
+ "pressed": "controlActive",
+ "disabled": "control"
+ }
+ }
}
],
"visible": true
@@ -273,6 +282,7 @@ export const BUILTIN_UI_PREFABS: Record<string, PrefabData> = {
"type": "UINode",
"data": {
"position": 1,
+ "display": 0,
"width": {
"value": 0,
"unit": 2
@@ -346,9 +356,9 @@ export const BUILTIN_UI_PREFABS: Record<string, PrefabData> = {
"fontFamily": "Arial",
"fontSize": 14,
"color": {
- "r": 1,
- "g": 1,
- "b": 1,
+ "r": 0.92,
+ "g": 0.92,
+ "b": 0.94,
"a": 1
},
"align": 1,
@@ -378,6 +388,12 @@ export const BUILTIN_UI_PREFABS: Record<string, PrefabData> = {
"renderMode": 0,
"enabled": true
}
+ },
+ {
+ "type": "ThemeStyle",
+ "data": {
+ "text": "text"
+ }
}
],
"visible": true
@@ -438,6 +454,7 @@ export const BUILTIN_UI_PREFABS: Record<string, PrefabData> = {
"type": "UINode",
"data": {
"position": 0,
+ "display": 0,
"width": {
"value": 28,
"unit": 0
@@ -509,9 +526,9 @@ export const BUILTIN_UI_PREFABS: Record<string, PrefabData> = {
"visualType": 1,
"texture": 0,
"color": {
- "r": 0.22,
- "g": 0.22,
- "b": 0.26,
+ "r": 1,
+ "g": 1,
+ "b": 1,
"a": 1
},
"uvOffset": {
@@ -547,15 +564,6 @@ export const BUILTIN_UI_PREFABS: Record<string, PrefabData> = {
"raycastTarget": true
}
},
- {
- "type": "UIInteraction",
- "data": {
- "hovered": false,
- "pressed": false,
- "justPressed": false,
- "justReleased": false
- }
- },
{
"type": "UIController",
"data": {
@@ -599,11 +607,28 @@ export const BUILTIN_UI_PREFABS: Record<string, PrefabData> = {
"g": 0.18,
"b": 0.22,
"a": 1
+ },
+ "disabled": {
+ "r": 0.22,
+ "g": 0.22,
+ "b": 0.26,
+ "a": 0.5
}
}
}
]
}
+ },
+ {
+ "type": "ThemeStyle",
+ "data": {
+ "states": {
+ "normal": "control",
+ "hover": "controlHover",
+ "pressed": "controlActive",
+ "disabled": "control"
+ }
+ }
}
],
"visible": true
@@ -655,6 +680,7 @@ export const BUILTIN_UI_PREFABS: Record<string, PrefabData> = {
"type": "UINode",
"data": {
"position": 1,
+ "display": 0,
"width": {
"value": 0,
"unit": 2
@@ -755,6 +781,12 @@ export const BUILTIN_UI_PREFABS: Record<string, PrefabData> = {
"material": 0,
"enabled": true
}
+ },
+ {
+ "type": "ThemeStyle",
+ "data": {
+ "visual": "primary"
+ }
}
],
"visible": true
@@ -816,6 +848,7 @@ export const BUILTIN_UI_PREFABS: Record<string, PrefabData> = {
"type": "UINode",
"data": {
"position": 0,
+ "display": 0,
"width": {
"value": 200,
"unit": 0
@@ -916,6 +949,12 @@ export const BUILTIN_UI_PREFABS: Record<string, PrefabData> = {
"material": 0,
"enabled": true
}
+ },
+ {
+ "type": "ThemeStyle",
+ "data": {
+ "visual": "track"
+ }
}
],
"visible": true
@@ -967,6 +1006,7 @@ export const BUILTIN_UI_PREFABS: Record<string, PrefabData> = {
"type": "UINode",
"data": {
"position": 1,
+ "display": 0,
"width": {
"value": 14,
"unit": 0
@@ -1067,6 +1107,12 @@ export const BUILTIN_UI_PREFABS: Record<string, PrefabData> = {
"material": 0,
"enabled": true
}
+ },
+ {
+ "type": "ThemeStyle",
+ "data": {
+ "visual": "onPrimary"
+ }
}
],
"visible": true
@@ -1118,6 +1164,7 @@ export const BUILTIN_UI_PREFABS: Record<string, PrefabData> = {
"type": "UINode",
"data": {
"position": 1,
+ "display": 0,
"width": {
"value": 0,
"unit": 2
@@ -1218,6 +1265,12 @@ export const BUILTIN_UI_PREFABS: Record<string, PrefabData> = {
"material": 0,
"enabled": true
}
+ },
+ {
+ "type": "ThemeStyle",
+ "data": {
+ "visual": "primary"
+ }
}
],
"visible": true
@@ -1278,6 +1331,7 @@ export const BUILTIN_UI_PREFABS: Record<string, PrefabData> = {
"type": "UINode",
"data": {
"position": 0,
+ "display": 0,
"width": {
"value": 200,
"unit": 0
@@ -1378,6 +1432,12 @@ export const BUILTIN_UI_PREFABS: Record<string, PrefabData> = {
"material": 0,
"enabled": true
}
+ },
+ {
+ "type": "ThemeStyle",
+ "data": {
+ "visual": "track"
+ }
}
],
"visible": true
@@ -1429,6 +1489,7 @@ export const BUILTIN_UI_PREFABS: Record<string, PrefabData> = {
"type": "UINode",
"data": {
"position": 1,
+ "display": 0,
"width": {
"value": 0,
"unit": 2
@@ -1529,6 +1590,12 @@ export const BUILTIN_UI_PREFABS: Record<string, PrefabData> = {
"material": 0,
"enabled": true
}
+ },
+ {
+ "type": "ThemeStyle",
+ "data": {
+ "visual": "primary"
+ }
}
],
"visible": true
@@ -1589,6 +1656,7 @@ export const BUILTIN_UI_PREFABS: Record<string, PrefabData> = {
"type": "UINode",
"data": {
"position": 0,
+ "display": 0,
"width": {
"value": 150,
"unit": 0
@@ -1698,15 +1766,6 @@ export const BUILTIN_UI_PREFABS: Record<string, PrefabData> = {
"raycastTarget": true
}
},
- {
- "type": "UIInteraction",
- "data": {
- "hovered": false,
- "pressed": false,
- "justPressed": false,
- "justReleased": false
- }
- },
{
"type": "UIController",
"data": {
@@ -1754,6 +1813,16 @@ export const BUILTIN_UI_PREFABS: Record<string, PrefabData> = {
}
]
}
+ },
+ {
+ "type": "ThemeStyle",
+ "data": {
+ "states": {
+ "normal": "control",
+ "hover": "controlHover",
+ "pressed": "controlActive"
+ }
+ }
}
],
"visible": true
@@ -1805,6 +1874,7 @@ export const BUILTIN_UI_PREFABS: Record<string, PrefabData> = {
"type": "UINode",
"data": {
"position": 1,
+ "display": 0,
"width": {
"value": 0,
"unit": 2
@@ -1910,6 +1980,12 @@ export const BUILTIN_UI_PREFABS: Record<string, PrefabData> = {
"renderMode": 0,
"enabled": true
}
+ },
+ {
+ "type": "ThemeStyle",
+ "data": {
+ "text": "text"
+ }
}
],
"visible": true
@@ -1970,6 +2046,7 @@ export const BUILTIN_UI_PREFABS: Record<string, PrefabData> = {
"type": "UINode",
"data": {
"position": 0,
+ "display": 0,
"width": {
"value": 240,
"unit": 0
@@ -2071,13 +2148,17 @@ export const BUILTIN_UI_PREFABS: Record<string, PrefabData> = {
"enabled": true
}
},
+ {
+ "type": "ThemeStyle",
+ "data": {
+ "visual": "control"
+ }
+ },
{
"type": "UIMask",
"data": {
"enabled": true,
- "mode": 0,
- "maskTexture": 0,
- "inverted": false
+ "mode": 0
}
},
{
@@ -2087,15 +2168,6 @@ export const BUILTIN_UI_PREFABS: Record<string, PrefabData> = {
"blockRaycast": true,
"raycastTarget": true
}
- },
- {
- "type": "UIInteraction",
- "data": {
- "hovered": false,
- "pressed": false,
- "justPressed": false,
- "justReleased": false
- }
}
],
"visible": true
@@ -2147,6 +2219,7 @@ export const BUILTIN_UI_PREFABS: Record<string, PrefabData> = {
"type": "UINode",
"data": {
"position": 1,
+ "display": 0,
"width": {
"value": 0,
"unit": 2
@@ -2220,9 +2293,9 @@ export const BUILTIN_UI_PREFABS: Record<string, PrefabData> = {
"fontFamily": "Arial",
"fontSize": 14,
"color": {
- "r": 1,
- "g": 1,
- "b": 1,
+ "r": 0.92,
+ "g": 0.92,
+ "b": 0.94,
"a": 1
},
"align": 1,
@@ -2252,6 +2325,12 @@ export const BUILTIN_UI_PREFABS: Record<string, PrefabData> = {
"renderMode": 0,
"enabled": true
}
+ },
+ {
+ "type": "ThemeStyle",
+ "data": {
+ "text": "text"
+ }
}
],
"visible": true
diff --git a/sdk/src/ui/widgets/toggle.ts b/sdk/src/ui/widgets/toggle.ts
index 031479829..bd137585a 100644
--- a/sdk/src/ui/widgets/toggle.ts
+++ b/sdk/src/ui/widgets/toggle.ts
@@ -8,6 +8,8 @@ import { Interactable, type InteractableData } from '../input/interactable';
import { createButton, type ButtonStateVisual } from './button';
import { spawnUIEntity, setUIVisible, type UINodeInit, type UIVisualInit } from './helpers';
+import { themeColors } from '../theme/tokens';
+import { markThemed } from '../theme/theme-style';
export interface ToggleOptions {
world: World;
@@ -18,8 +20,9 @@ export interface ToggleOptions {
/** Background renderer for the frame. */
background?: UIVisualInit;
- /** Interaction states (normal / hover / pressed / disabled) for the frame. */
- interactionStates: Record<string, ButtonStateVisual>;
+ /** Interaction states (normal / hover / pressed / disabled) for the frame.
+ * Defaults to the active theme's control roles (as createButton). */
+ interactionStates?: Record<string, ButtonStateVisual>;
/**
* Optional rendering for the on-state indicator ("check mark").
@@ -66,18 +69,19 @@ export function createToggle(opts: ToggleOptions): ToggleHandle {
disabled: opts.disabled,
});
+ // The on-state indicator defaults to the theme accent so it re-themes live;
+ // a caller-supplied color is the caller's own.
const check = spawnUIEntity({
world,
parent: button,
node: opts.check?.node ?? { fill: true },
- visual: opts.check
- ? {
- color: opts.check.color,
- texture: opts.check.sprite,
- visualType: opts.check.sprite ? 2 /* Image */ : 1 /* SolidColor */,
- }
- : {},
+ visual: {
+ color: opts.check?.color ?? themeColors().primary,
+ texture: opts.check?.sprite,
+ visualType: opts.check?.sprite ? 2 /* Image */ : 1 /* SolidColor */,
+ },
});
+ if (opts.check?.color === undefined) markThemed(world, check, { visual: 'primary' });
setUIVisible(world, check, isOn);
diff --git a/sdk/tests/ui-widget-prefabs.gen.test.ts b/sdk/tests/ui-widget-prefabs.gen.test.ts
index a439a021e..2c2d52c38 100644
--- a/sdk/tests/ui-widget-prefabs.gen.test.ts
+++ b/sdk/tests/ui-widget-prefabs.gen.test.ts
@@ -14,8 +14,9 @@ import { createProgress } from '../src/ui/widgets/progress';
import { createDropdown } from '../src/ui/widgets/dropdown';
import { spawnUIEntity } from '../src/ui/widgets/helpers';
import { UIMask, MaskMode } from '../src/ui/core/ui-mask';
-import { Interactable, UIInteraction } from '../src/ui/input/interactable';
+import { Interactable } from '../src/ui/input/interactable';
import { themeColors } from '../src/ui/theme/tokens';
+import { markThemed } from '../src/ui/theme/theme-style';
import { px } from '../src/ui/core/dimension';
const OUT_DIR = resolve(__dirname, '../src/ui/widgets/prefabs');
@@ -54,21 +55,18 @@ afterAll(() => {
describe('UI widget prefab codegen', () => {
it('Button: factory → prefab captures the full clickable tree + label', () => {
const prefab = generate('Button', (world) =>
+ // No explicit states/colors: the factory's theme defaults also tag the
+ // entities with ThemeStyle roles, so the prefab re-themes at runtime.
createButton({
world, events: noEvents,
node: { width: px(140), height: px(40) },
- states: {
- normal: { color: c.control },
- hover: { color: c.controlHover },
- pressed: { color: c.controlActive },
- },
- text: { content: 'Button', color: c.onPrimary, fontSize: 14 },
+ text: { content: 'Button', fontSize: 14 },
}) as unknown as number,
);
const root = typesOf(prefab, prefab.rootEntityId);
expect(root).toEqual(expect.arrayContaining([
- 'Transform', 'UINode', 'UIVisual', 'Interactable', 'UIInteraction', 'UIController', 'UIGear',
+ 'Transform', 'UINode', 'UIVisual', 'Interactable', 'UIController', 'UIGear',
]));
const rootEnt = entityById(prefab, prefab.rootEntityId);
expect(rootEnt.children.length).toBe(1);
@@ -82,11 +80,7 @@ describe('UI widget prefab codegen', () => {
createToggle({
world, events: noEvents,
node: { width: px(28), height: px(28) },
- background: { color: c.control },
- interactionStates: {
- normal: { color: c.control }, hover: { color: c.controlHover }, pressed: { color: c.controlActive },
- },
- check: { color: c.primary }, isOn: true,
+ isOn: true,
}).entity as unknown as number,
);
expect(typesOf(prefab, prefab.rootEntityId)).toEqual(expect.arrayContaining(['UINode', 'Interactable', 'UIGear']));
@@ -107,7 +101,7 @@ describe('UI widget prefab codegen', () => {
const prefab = generate('Progress', (world) =>
createProgress({
world, node: { width: px(200), height: px(14) },
- fill: { color: c.primary }, value: 0.4,
+ value: 0.4,
}).entity as unknown as number,
);
expect(entityById(prefab, prefab.rootEntityId).children.length).toBe(1);
@@ -134,14 +128,15 @@ describe('UI widget prefab codegen', () => {
node: { width: px(240), height: px(320) },
visual: { color: c.control },
});
- world.insert(viewport, UIMask, { enabled: true, mode: MaskMode.Scissor, maskTexture: 0, inverted: false });
+ markThemed(world, viewport, { visual: 'control' });
+ world.insert(viewport, UIMask, { enabled: true, mode: MaskMode.Scissor });
world.insert(viewport, Interactable, { enabled: true, blockRaycast: true, raycastTarget: true });
- world.insert(viewport, UIInteraction, { hovered: false, pressed: false, justPressed: false, justReleased: false });
- spawnUIEntity({
+ const label = spawnUIEntity({
world, parent: viewport,
node: { fill: true },
- text: { content: 'List View', color: c.onPrimary, fontSize: 14 },
+ text: { content: 'List View', color: c.text, fontSize: 14 },
});
+ markThemed(world, label, { text: 'text' });
return viewport as unknown as number;
});
expect(typesOf(prefab, prefab.rootEntityId)).toEqual(expect.arrayContaining([
diff --git a/src/esengine/bindings/WebBindings.generated.cpp b/src/esengine/bindings/WebBindings.generated.cpp
index 1ae74c5de..fb43236cc 100644
--- a/src/esengine/bindings/WebBindings.generated.cpp
+++ b/src/esengine/bindings/WebBindings.generated.cpp
@@ -182,6 +182,10 @@ EMSCRIPTEN_BINDINGS(esengine_enums) {
.value("Center", esengine::ecs::TextAlign::Center)
.value("Right", esengine::ecs::TextAlign::Right);
+ enum_<esengine::ecs::UIDisplay>("UIDisplay")
+ .value("Flex", esengine::ecs::UIDisplay::Flex)
+ .value("None", esengine::ecs::UIDisplay::None);
+
enum_<esengine::ecs::UIFillMethod>("UIFillMethod")
.value("Horizontal", esengine::ecs::UIFillMethod::Horizontal)
.value("Vertical", esengine::ecs::UIFillMethod::Vertical)
@@ -770,6 +774,7 @@ UIMaskJS uimaskToJS(const esengine::ecs::UIMask& c) {
struct UINodeJS {
i32 position;
+ i32 display;
Dimension width;
Dimension height;
Dimension minWidth;
@@ -793,6 +798,7 @@ struct UINodeJS {
esengine::ecs::UINode uinodeFromJS(const UINodeJS& js) {
esengine::ecs::UINode c;
c.position = static_cast<UIPositionType>(js.position);
+ c.display = static_cast<UIDisplay>(js.display);
c.width = js.width;
c.height = js.height;
c.minWidth = js.minWidth;
@@ -817,6 +823,7 @@ esengine::ecs::UINode uinodeFromJS(const UINodeJS& js) {
UINodeJS uinodeToJS(const esengine::ecs::UINode& c) {
UINodeJS js;
js.position = static_cast<i32>(c.position);
+ js.display = static_cast<i32>(c.display);
js.width = c.width;
js.height = c.height;
js.minWidth = c.minWidth;
@@ -1151,6 +1158,7 @@ EMSCRIPTEN_BINDINGS(esengine_components) {
value_object<UINodeJS>("UINode")
.field("position", &UINodeJS::position)
+ .field("display", &UINodeJS::display)
.field("width", &UINodeJS::width)
.field("height", &UINodeJS::height)
.field("minWidth", &UINodeJS::minWidth)
@@ -2023,6 +2031,7 @@ static_assert(offsetof(esengine::ecs::UIInteraction, justReleased) == 3, "ABI of
static_assert(offsetof(esengine::ecs::UIMask, enabled) == 0, "ABI offset drift: esengine::ecs::UIMask.enabled (EHT expected 0)");
static_assert(offsetof(esengine::ecs::UIMask, mode) == 1, "ABI offset drift: esengine::ecs::UIMask.mode (EHT expected 1)");
static_assert(offsetof(esengine::ecs::UINode, position) == 0, "ABI offset drift: esengine::ecs::UINode.position (EHT expected 0)");
+static_assert(offsetof(esengine::ecs::UINode, display) == 1, "ABI offset drift: esengine::ecs::UINode.display (EHT expected 1)");
static_assert(offsetof(esengine::ecs::UINode, flexGrow) == 52, "ABI offset drift: esengine::ecs::UINode.flexGrow (EHT expected 52)");
static_assert(offsetof(esengine::ecs::UINode, flexShrink) == 56, "ABI offset drift: esengine::ecs::UINode.flexShrink (EHT expected 56)");
static_assert(offsetof(esengine::ecs::UINode, alignSelf) == 68, "ABI offset drift: esengine::ecs::UINode.alignSelf (EHT expected 68)");
@@ -2046,7 +2055,7 @@ static_assert(offsetof(esengine::ecs::Velocity, angular) == 12, "ABI offset drif
// ABI Hash -- runtime handshake against the SDK bundle
// =============================================================================
-static const char* kEsAbiLayoutHash = "f9191aeae848066e";
+static const char* kEsAbiLayoutHash = "bde213b560e9ce4c";
std::string esengineGetAbiLayoutHash() {
return std::string(kEsAbiLayoutHash);