Class HudWindow
A draggable, resizable immediate-mode GUI window rendered by ConnectorHud.
Inherited Members
Namespace: Unity.SimulationPro.Foundation
Assembly: Unity.SimulationPro.Foundation.dll
Syntax
public class HudWindow
Remarks
Create a HudWindow instance, set its content via SetOnGUI(Action), then register it with AddWindow(HudWindow). The window supports drag-to-move on its title bar and drag-to-resize on its left, right, and bottom edges.
Constructors
HudWindow(string)
Creates a new HudWindow that automatically finds a free screen position on first draw.
Declaration
public HudWindow(string title)
Parameters
| Type | Name | Description |
|---|---|---|
| string | title | The title shown in the window's title bar. |
HudWindow(string, Rect)
Creates a new HudWindow with a fixed screen rectangle.
Declaration
public HudWindow(string title, Rect rect)
Parameters
| Type | Name | Description |
|---|---|---|
| string | title | The title shown in the window's title bar. |
| Rect | rect | The initial screen rectangle for the window. |
Properties
HasActiveRect
Gets a value indicating whether this window is active and has a fixed screen rectangle.
Declaration
public bool HasActiveRect { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsActive
Gets a value indicating whether this window is currently visible.
Declaration
public bool IsActive { get; }
Property Value
| Type | Description |
|---|---|
| bool |
WindowRect
Gets the current screen rectangle occupied by this window.
Declaration
public Rect WindowRect { get; }
Property Value
| Type | Description |
|---|---|
| Rect |
Methods
DrawWindow(ConnectorHud)
Draws this window using immediate-mode GUI if it is active.
Declaration
public void DrawWindow(ConnectorHud hud)
Parameters
| Type | Name | Description |
|---|---|---|
| ConnectorHud | hud | The owning ConnectorHud instance used for layout queries. |
EndDragWindow()
Ends the current drag operation, clearing all drag state flags.
Declaration
public void EndDragWindow()
SetActive(bool)
Shows or hides the window.
Declaration
public void SetActive(bool active)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | active |
|
SetGUIMenu(Action<IMenuFiller>)
Sets the action called to populate the window's context menu.
Declaration
public void SetGUIMenu(Action<IMenuFiller> guiMenu)
Parameters
| Type | Name | Description |
|---|---|---|
| Action<IMenuFiller> | guiMenu | An action that receives an IMenuFiller and adds items to the context menu. |
SetOnGUI(Action)
Sets the action called each frame to draw the window's content.
Declaration
public void SetOnGUI(Action guiDrawer)
Parameters
| Type | Name | Description |
|---|---|---|
| Action | guiDrawer | An action that draws content using immediate-mode GUI. |
TryDragWindow(Event)
Checks whether the mouse-down event begins a drag of this window's title bar or edges, and records the drag offset if so.
Declaration
public bool TryDragWindow(Event current)
Parameters
| Type | Name | Description |
|---|---|---|
| Event | current | The current GUI mouse-down event. |
Returns
| Type | Description |
|---|---|
| bool |
|
UpdateDragWindow(Event)
Updates the window's position or size based on the current mouse-drag event.
Declaration
public void UpdateDragWindow(Event current)
Parameters
| Type | Name | Description |
|---|---|---|
| Event | current | The current GUI mouse-drag event. |