Skip to content

Commit 1436e4d

Browse files
committed
Polish native editor UI and console
1 parent b489ab3 commit 1436e4d

75 files changed

Lines changed: 2715 additions & 470 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
-870 Bytes
Loading

LuaUI/rml_setup2.lua

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,14 @@ end
7474

7575
-- when "cursor: normal" is set via RCSS, "cursornormal" will be sent to the engine... and so on for the rest
7676
RmlUi.SetMouseCursorAlias("default", 'cursornormal')
77-
RmlUi.SetMouseCursorAlias("pointer", 'Move') -- command cursors use the command name. TODO: replace with actual pointer cursor?
77+
-- A CSS pointer is UI affordance, not the engine's animated Move-command
78+
-- cursor. Keeping the normal cursor avoids a distracting cursor swap for
79+
-- every button, grid item, and dropdown.
80+
RmlUi.SetMouseCursorAlias("pointer", 'cursornormal')
7881
RmlUi.SetMouseCursorAlias("move", 'uimove')
7982
RmlUi.SetMouseCursorAlias("nesw-resize", 'uiresized2')
8083
RmlUi.SetMouseCursorAlias("nwse-resize", 'uiresized1')
8184
RmlUi.SetMouseCursorAlias("ns-resize", 'uiresizev')
8285
RmlUi.SetMouseCursorAlias("ew-resize", 'uiresizeh')
8386

84-
RmlUi.CreateContext("shared")
87+
RmlUi.CreateContext("shared")

LuaUI/widgets/api_chilifx.lua

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@ LCS = LCS()
1717
CHILILFX_DIR = "libs_sb/chilifx/chilifx/"
1818

1919
function widget:Initialize()
20-
-- if not WG.Chili then
21-
-- Spring.Log("ChiliFX", LOG.ERROR, "Missing chiliui.")
22-
-- widgetHandler:RemoveWidget(widget)
23-
-- return
24-
-- end
20+
-- ChiliFX only backs Chili/Chotify. Native and RmlUi own their effects, so
21+
-- do not even construct this legacy effect library in those UI modes.
22+
if Spring.GetGameRulesParam("sb_ui") ~= "chili" then
23+
widgetHandler:RemoveWidget(widget)
24+
return
25+
end
2526

2627
ChiliFX = VFS.Include(CHILILFX_DIR .. "core.lua", nil)
2728

LuaUI/widgets/dbg_dev_console_rmlui.lua

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ local cfg = {
2727

2828
local debugButtonEnabled = false
2929
local profilerButtonEnabled = false
30+
local engineConsoleHidden = false
3031

3132
local Spring = Spring
3233
local VFS = VFS
@@ -663,11 +664,19 @@ end
663664

664665
-- ---------- Widget lifecycle ----------
665666
function widget:Initialize()
667+
-- Rust owns the developer console in its UI mode. Keep this guard separate
668+
-- from the legacy `useRml` flag so this widget never changes engine-console
669+
-- state while removing itself for Rust.
670+
if Spring.GetGameRulesParam("sb_ui") ~= "rmlui" then
671+
widgetHandler:RemoveWidget(self)
672+
return
673+
end
666674
if Spring.GetGameRulesParam("useRml") ~= "true" then
667675
widgetHandler:RemoveWidget(self)
668676
return
669677
end
670678
Spring.SendCommands('console 0')
679+
engineConsoleHidden = true
671680
if Spring.GetGameRulesParam("gameMode") == "play" then
672681
widgetHandler:RemoveWidget(self)
673682
return
@@ -716,7 +725,9 @@ function widget:Shutdown()
716725
rml.dataModel = nil
717726
mouseCaptured = false
718727
WG.DevConsole = nil
719-
Spring.SendCommands('console 1')
728+
if engineConsoleHidden then
729+
Spring.SendCommands('console 1')
730+
end
720731
end
721732

722733
function widget:Update()

LuaUI/widgets/gui_rmlui_cursortip.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,12 @@ local function Show(title, rows, key, mx, my)
168168
end
169169

170170
function widget:Initialize()
171+
-- The native UI owns its own cursor tip. `useRml` is false for Rust today,
172+
-- but keep this explicit so a stale compatibility flag cannot load both.
173+
if Spring.GetGameRulesParam("sb_ui") ~= "rmlui" then
174+
widgetHandler:RemoveWidget(widget)
175+
return
176+
end
171177
if Spring.GetGameRulesParam("useRml") ~= "true" then
172178
widgetHandler:RemoveWidget(widget)
173179
return

config/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,9 @@ The old names (`rust-rmlui.json`, `mixed-rust-*`) named the *chonsole*, not the
1919
UI, so `rust-rmlui` was the Lua UI. They are renamed above.
2020

2121
just run config/ui-rust.json
22+
23+
Manual Rust-Chonsole sessions use a stable history file at
24+
`$XDG_STATE_HOME/springboard/chonsole-history` (or
25+
`~/.local/state/springboard/chonsole-history`). Set `SBC_CHONSOLE_HISTORY` to
26+
use a different file while testing. Smoke and E2E runs deliberately keep their
27+
history inside their disposable isolated write directory.

libs_sb/chonsole

native/Cargo.lock

Lines changed: 142 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

native/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ thiserror = "2.0.18"
2121
ctrl_macros = "0.1.0"
2222
image = { version = "0.25", default-features = false, features = ["png", "bmp", "jpeg", "tga"] }
2323
zip = { version = "2.2", default-features = false, features = ["deflate"] }
24+
sysinfo = "0.37"

0 commit comments

Comments
 (0)