Files
西风逍遥游andCursor Agent 488cf0c9ef feat(ui): add Flex/Row/Column elastic layout for UI containers (#34)
Introduce Flex containers with gap, flexGrow, align, and justify so
toolbars and panels can lay out without manual SameLine, including
Spacer and script builder APIs.

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-08-11 20:41:20 +08:00

39 lines
1.0 KiB
Plaintext

// Multi-host ECS UI demo (use as main.nut).
// Demonstrates unified theme switching (dark/light share geometry & fonts).
eve_init = function() {
ui.setTheme("dark");
ui.setNavKeyboard(true);
ui.beginBuild();
ui.beginWindow("Inventory", "root");
ui.text("Theme: " + ui.getTheme(), "status");
ui.beginRow("actions", 8.0);
ui.setFlexJustify("space-between");
ui.button("Use", "use");
ui.spacer("sp");
ui.button("Toggle Theme", "theme");
ui.end();
ui.end();
ui.mountBuildAs("inv");
};
eve_update = function(dt) {
local c = ui.consumeClick();
while (c != "") {
if (c == "inv/use") {
ui.setText("status", "Used (" + ui.getTheme() + ")");
} else if (c == "inv/theme") {
if (ui.getTheme() == "dark") ui.setTheme("light");
else ui.setTheme("dark");
ui.setText("status", "Theme: " + ui.getTheme());
}
c = ui.consumeClick();
}
};
eve_render = function() {
gfx.clear();
ui.beginFrameAndRender();
};