diff --git a/Plugins/RynthCore.Plugin.RynthLua/LibraryViews.cs b/Plugins/RynthCore.Plugin.RynthLua/LibraryViews.cs index d759b15..3ee72bc 100644 --- a/Plugins/RynthCore.Plugin.RynthLua/LibraryViews.cs +++ b/Plugins/RynthCore.Plugin.RynthLua/LibraryViews.cs @@ -8,7 +8,7 @@ namespace RynthCore.Plugin.RynthLua; /// views.Huds.GetIconTexture / GetObjectIconTexture / GetSpellIconTexture (LibraryIcons.cs). /// The imgui module is in LibraryImGui.cs. /// -/// hud (§1.2): Name, LastError, IsDisposed (read-only); Title, Visible, ShowInBar, +/// hud (§1.2): Name, LastError, IsDisposed (read-only); Title, Visible, ShowInBar, NoPopOut, /// WindowSettings, Chrome, DefaultSize, RefreshRate (read/write); OnPreRender / OnRender / /// OnShow / OnHide (events with Add / Once / Until / Remove); Dispose(). ImGui calls only /// record into the hud's display list during its render pass (ScriptWindows.cs); results @@ -77,6 +77,7 @@ public sealed partial class RynthLuaPlugin "Title" => DynValue.NewString(hud.Title), "Visible" => DynValue.NewBoolean(hud.Visible), "ShowInBar" => DynValue.NewBoolean(hud.ShowInBar), + "NoPopOut" => DynValue.NewBoolean(hud.NoPopOut), "WindowSettings" => DynValue.NewNumber(hud.WindowSettings), "Chrome" => DynValue.NewString(hud.ChromeNone ? "none" : "standard"), "DefaultSize" => LibraryImGuiValues.NewVec2(s, hud.DefaultSize.X, hud.DefaultSize.Y), @@ -106,6 +107,13 @@ public sealed partial class RynthLuaPlugin if (hud.ShowInBar != show) { hud.ShowInBar = show; hud.PropsDirty = true; } break; } + case "NoPopOut": + { + // No ↗ for this window; set while it is popped out, it goes back into the game window. + bool no = v.CastToBool(); + if (hud.NoPopOut != no) { hud.NoPopOut = no; hud.PropsDirty = true; } + break; + } case "WindowSettings": SetHudWindowSettings(hud, WindowSettingsArg(v)); break; diff --git a/Plugins/RynthCore.Plugin.RynthLua/ScriptHud.cs b/Plugins/RynthCore.Plugin.RynthLua/ScriptHud.cs index b128c25..2db1fc6 100644 --- a/Plugins/RynthCore.Plugin.RynthLua/ScriptHud.cs +++ b/Plugins/RynthCore.Plugin.RynthLua/ScriptHud.cs @@ -41,6 +41,8 @@ internal sealed class ScriptHud public bool NoBackground = false; public bool NoScrollbar = false; public bool NoScrollWithMouse = false; + /// No ↗: the window can't pop out of the game window (a bare, Chrome "none", one never can). + public bool NoPopOut = false; /// Panel logical units; 0 = the engine's default. Persistent. public Vector2 DefaultSize = Vector2.Zero; public Vector2 MinSize = Vector2.Zero; @@ -148,6 +150,7 @@ internal sealed class ScriptHud if (NoBackground) f |= HudFormat.FlagNoBackground; if (NoScrollbar) f |= HudFormat.FlagNoScrollbar; if (NoScrollWithMouse) f |= HudFormat.FlagNoScrollWithMouse; + if (NoPopOut) f |= HudFormat.FlagNoPopOut; if (LastError != null) f |= HudFormat.FlagHasError; if (PosIsDefault && !HudFormat.IsNone(RequestPos)) f |= HudFormat.FlagPosIsDefault; return f; @@ -278,6 +281,7 @@ internal static class HudFormat public const uint FlagNoBackground = 1u << 4; public const uint FlagNoScrollbar = 1u << 5; public const uint FlagNoScrollWithMouse = 1u << 6; + public const uint FlagNoPopOut = 1u << 8; public const uint FlagHasError = 1u << 9; public const uint FlagPosIsDefault = 1u << 10; diff --git a/Plugins/RynthCore.Plugin.RynthLua/Types/rynthlua.d.lua b/Plugins/RynthCore.Plugin.RynthLua/Types/rynthlua.d.lua index 656788c..3269328 100644 --- a/Plugins/RynthCore.Plugin.RynthLua/Types/rynthlua.d.lua +++ b/Plugins/RynthCore.Plugin.RynthLua/Types/rynthlua.d.lua @@ -2556,6 +2556,7 @@ Vector4 = {} ---@field Title string The header text (default, and nil: the name). ---@field Visible boolean Starts as the player's last choice for this hud on this character, else false. Set by the script, it isn't remembered. ---@field ShowInBar boolean Listed in the bar's Scripts menu (default true). +---@field NoPopOut boolean No ↗: the window can't pop out of the game window (default false; bare windows never do). ---@field WindowSettings ImGuiWindowFlags|integer The whole flag set (0 to 4294967295; nil = 0). Honoured: NoTitleBar, NoInputs/NoMouseInputs, NoBackground, NoScrollbar, NoScrollWithMouse. ---@field Chrome RynthLua.HudChrome "standard" (the RynthCore frame) or "none" (no header or grip). ---@field DefaultSize Vector2 Size while nothing is saved for the window; nil = the engine default. Also takes {x, y}. diff --git a/Tools/RynthLua.ScriptWindowsTests/Program.cs b/Tools/RynthLua.ScriptWindowsTests/Program.cs index cb446ad..503145f 100644 --- a/Tools/RynthLua.ScriptWindowsTests/Program.cs +++ b/Tools/RynthLua.ScriptWindowsTests/Program.cs @@ -1643,6 +1643,19 @@ namespace RynthLua.ScriptWindowsTests r.Do("hud.ShowInBar = false"); Check(!h.ShowInBar && h.PropsDirty && (h.HeaderFlags() & HudFormat.FlagShowInBar) == 0, "ShowInBar false clears the header bit"); + // NoPopOut (header bit8: no ↗; the engine redocks a popped-out window when it turns on). + Check(!r.Eval("hud.NoPopOut").CastToBool() && (h.HeaderFlags() & HudFormat.FlagNoPopOut) == 0, "NoPopOut starts false"); + h.PropsDirty = false; + r.Do("hud.NoPopOut = true"); + Check(h.NoPopOut && h.PropsDirty && (h.HeaderFlags() & HudFormat.FlagNoPopOut) != 0 && r.Eval("hud.NoPopOut").CastToBool(), "NoPopOut true sets the header bit"); + int rcPop = Parse(new[] { h }, out var wPop, out string errPop, out _); + Check(rcPop == 0 && (wPop[0].Flags & WindowFlags.NoPopOut) != 0 && HudFormat.FlagNoPopOut == WindowFlags.NoPopOut, "the engine reads NoPopOut " + errPop); + h.PropsDirty = false; + r.Do("hud.NoPopOut = true"); + Check(!h.PropsDirty, "setting the same NoPopOut again changes nothing"); + r.Do("hud.NoPopOut = false"); + Check(!h.NoPopOut && h.PropsDirty && (h.HeaderFlags() & HudFormat.FlagNoPopOut) == 0, "NoPopOut false clears it"); + // Read-only members and the script's own fields. LuaFails(r, "hud.Name = 'x'", "read-only"); LuaFails(r, "hud.LastError = 'x'", "read-only");