Skip to content

armgit / raea

Public Imported from GitHub
0

Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.

FC0a: ui/widgets/headless_tabs ports at 0.9930: four tab lists coloured as update_tab_styles leaves them (selected, disabled, the rest). 90 of 94 ported examples pass

shinyobjectz0652b7531394
diff --git a/bench/bevy-parity/examples.list b/bench/bevy-parity/examples.list
index 35ffa6e1..2f3ae724 100644
--- a/bench/bevy-parity/examples.list
+++ b/bench/bevy-parity/examples.list
@@ -93,3 +93,4 @@ ui/render_ui_to_texture
ui/ui_drag_and_drop
ui/navigation/directional_navigation
ui/navigation/directional_navigation_overrides
+ui/widgets/headless_tabs
diff --git a/bench/bevy-parity/runs.tsv b/bench/bevy-parity/runs.tsv
index b7c3b096..01ea814b 100644
--- a/bench/bevy-parity/runs.tsv
+++ b/bench/bevy-parity/runs.tsv
@@ -92,3 +92,4 @@ ui/render_ui_to_texture - 10
ui/ui_drag_and_drop - 10
ui/navigation/directional_navigation - 10
ui/navigation/directional_navigation_overrides - 10
+ui/widgets/headless_tabs - 10
diff --git a/docs/bevy-parity.md b/docs/bevy-parity.md
index 2afee694..90eadc65 100644
--- a/docs/bevy-parity.md
+++ b/docs/bevy-parity.md
@@ -4,7 +4,7 @@ Bevy v0.20.0's examples against their raea TSX ports (docs/control.feature FC0a)
don't edit. An example passes when every probed frame passes pixels (SSIM 0.98 and no 32 px tile off by more than 24 of 255) and cost (batch keys and
frame time at most 1.25x the example's). Wall time is one machine's, measured in the same run.
-Examples: **438**, ported **93**, passing **89**, excluded **16** (docs/bevy-parity/excluded.tsv), left **333**.
+Examples: **438**, ported **94**, passing **90**, excluded **16** (docs/bevy-parity/excluded.tsv), left **332**.
raea's frame ms is its update's plus the time React takes to step a frame for its 3D (step), which the example
doesn't pay.
@@ -149,6 +149,7 @@ doesn't pay.
| ui/ui_drag_and_drop | 10 | 0.999046 | 3 | 0 / 0 | 1241 / 493 | 5 / 7 | 1 / 1 | 37.598 / 1.739 = 1.739 + 0 | yes | |
| ui/navigation/directional_navigation | 10 | 0.998057 | 8 | 0 / 0 | 471 / 493 | 5 / 7 | 1 / 1 | 37.601 / 1.225 = 1.225 + 0 | yes | |
| ui/navigation/directional_navigation_overrides | 10 | 0.996122 | 11 | 0 / 0 | 564 / 493 | 5 / 7 | 1 / 1 | 38.217 / 1.757 = 1.757 + 0 | yes | |
+| ui/widgets/headless_tabs | 10 | 0.992999 | 11 | 0 / 0 | 478 / 493 | 5 / 7 | 1 / 1 | 44.815 / 1.798 = 1.798 + 0 | yes | |
## Excluded
diff --git a/sdk/raea/bench/bevy-parity/ui/widgets/headless_tabs.tsx b/sdk/raea/bench/bevy-parity/ui/widgets/headless_tabs.tsx
new file mode 100644
index 00000000..895df6a4
--- /dev/null
+++ b/sdk/raea/bench/bevy-parity/ui/widgets/headless_tabs.tsx
@@ -0,0 +1,54 @@
+// Bevy v0.20.0 examples/ui/widgets/headless_tabs.rs in raea's TSX (docs/control.feature FC0a): on srgb(0.06, 0.07,
+// 0.09), a full-window column (24 px padding, 18 px rows, its items at the start, scrolling on y) of four tab lists,
+// each under a 17 px srgb(0.72, 0.76, 0.84) label: a strip (srgb(0.10, 0.11, 0.14), a row or for the vertical one a
+// column) of tab headers at least 112 x 36 (12 x 8 px padding, a 1 px srgb(0.24, 0.25, 0.30) border) holding a 16 px
+// srgb(0.88, 0.89, 0.92) label. update_tab_styles colours each header: the list's SelectedTab srgb(0.18, 0.34, 0.52),
+// an InteractionDisabled one srgb(0.10, 0.10, 0.11), the rest srgb(0.13, 0.14, 0.18); nothing has focus, so every
+// border keeps its colour. Hover, the keys and clicks change them only under input. Bevy's Camera2d over the default
+// clear colour is the layered <Canvas3D>, in Bevy's default 1280 x 720 window.
+import { AbsoluteFill, Composition, registerRoot } from "raea";
+import { Canvas3D } from "raea/3d";
+import { Node, Overflow, Text, UiRect, percent, px } from "raea/ui";
+import { Srgba } from "raea/color";
+
+const SELECTED = new Srgba(0.18, 0.34, 0.52);
+const DISABLED = new Srgba(0.1, 0.1, 0.11);
+const NORMAL = new Srgba(0.13, 0.14, 0.18);
+
+interface Header { label: string; selected?: boolean; disabled?: boolean }
+
+function Label({ children }: { children: string }) {
+ return <Text font_size={{ Px: 17 }} color={new Srgba(0.72, 0.76, 0.84)}>{children}</Text>;
+}
+
+function Strip({ vertical, headers }: { vertical?: boolean; headers: Header[] }) {
+ return (
+ <Node display="Flex" flex_direction={vertical ? "Column" : "Row"} align_items="Stretch" background_color={new Srgba(0.1, 0.11, 0.14)}>
+ {headers.map((h) => (
+ <Node key={h.label} min_width={px(112)} min_height={px(36)} padding={UiRect.axes(px(12), px(8))} border={UiRect.all(px(1))} align_items="Center" justify_content="Center" background_color={h.disabled ? DISABLED : h.selected ? SELECTED : NORMAL} border_color={new Srgba(0.24, 0.25, 0.3)}>
+ <Text font_size={{ Px: 16 }} color={new Srgba(0.88, 0.89, 0.92)}>{h.label}</Text>
+ </Node>
+ ))}
+ </Node>
+ );
+}
+
+function Shot() {
+ return (
+ <AbsoluteFill>
+ <Canvas3D layered clearColor="rgb(43, 44, 47)" />
+ <Node width={percent(100)} height={percent(100)} padding={UiRect.all(px(24))} display="Flex" flex_direction="Column" align_items="Start" row_gap={px(18)} overflow={Overflow.scroll_y()} background_color={new Srgba(0.06, 0.07, 0.09)}>
+ <Label>Horizontal automatic - self-updating</Label>
+ <Strip headers={[{ label: "General", selected: true }, { label: "Rendering" }, { label: "Disabled", disabled: true }]} />
+ <Label>Horizontal manual - focus and selection are separate</Label>
+ <Strip headers={[{ label: "Scene", selected: true }, { label: "Assets" }, { label: "Inspector" }]} />
+ <Label>Vertical manual</Label>
+ <Strip vertical headers={[{ label: "Transform", selected: true }, { label: "Visibility" }, { label: "Metadata" }]} />
+ <Label>Controlled - observer updates external state</Label>
+ <Strip headers={[{ label: "External A", selected: true }, { label: "External B" }]} />
+ </Node>
+ </AbsoluteFill>
+ );
+}
+
+registerRoot(() => <Composition id="main" component={Shot} durationInFrames={11} fps={60} width={1280} height={720} />);