Interface IGuiControl
- Namespace
- Gloam.Core.Ui.Interfaces.Controls
- Assembly
- Gloam.Core.Ui.dll
Represents a GUI control that can be rendered, updated, and interacted with
public interface IGuiControl
Properties
Background
Gets or sets the background color of the control
Color Background { get; set; }
Property Value
Children
Gets the collection of child controls
IList<IGuiControl> Children { get; }
Property Value
DrawOrder
Gets or sets the drawing order priority (higher values drawn later)
int DrawOrder { get; set; }
Property Value
Foreground
Gets or sets the foreground color of the control
Color Foreground { get; set; }
Property Value
HoverBackground
Gets or sets the background color when the control is hovered
Color HoverBackground { get; set; }
Property Value
HoverForeground
Gets or sets the foreground color when the control is hovered
Color HoverForeground { get; set; }
Property Value
IsDirty
Gets or sets whether the control needs to be redrawn
bool IsDirty { get; set; }
Property Value
IsFocused
Gets or sets whether the control currently has focus
bool IsFocused { get; set; }
Property Value
IsHovered
Gets whether the control is currently being hovered by the mouse
bool IsHovered { get; }
Property Value
IsVisible
Gets or sets whether the control is visible
bool IsVisible { get; set; }
Property Value
Parent
Gets or sets the parent control
IGuiControl? Parent { get; set; }
Property Value
Position
Gets or sets the position of the control
Position Position { get; set; }
Property Value
Size
Gets or sets the size of the control
Size Size { get; set; }
Property Value
Methods
AddChild(IGuiControl)
Adds a child control to this control
void AddChild(IGuiControl child)
Parameters
child
IGuiControlThe child control to add
Contains(Position)
Determines if a point is within the bounds of this control
bool Contains(Position point)
Parameters
point
PositionThe point to test
Returns
- bool
True if the point is within the control bounds
Invalidate()
Marks the control as dirty, requiring a redraw
void Invalidate()
RemoveChild(IGuiControl)
Removes a child control from this control
bool RemoveChild(IGuiControl child)
Parameters
child
IGuiControlThe child control to remove
Returns
- bool
True if the child was removed, false if it was not found
Render(IGuiRenderer)
Renders the control and its children
void Render(IGuiRenderer renderer)
Parameters
renderer
IGuiRendererThe renderer to use for drawing
Update(IInputDevice, TimeSpan)
Updates the control state based on input and game logic
void Update(IInputDevice inputDevice, TimeSpan deltaTime)
Parameters
inputDevice
IInputDeviceThe input device for handling user input
deltaTime
TimeSpanThe time elapsed since the last update
Events
MouseClick
Event fired when the control is clicked
event EventHandler<MouseClickEventArgs>? MouseClick
Event Type
MouseDrag
Event fired when mouse drag occurs over the control
event EventHandler<MouseDragEventArgs>? MouseDrag
Event Type
MouseWheel
Event fired when mouse wheel is scrolled over the control
event EventHandler<MouseWheelEventArgs>? MouseWheel