Table of Contents

Class GuiRenderer

Namespace
Gloam.Core.Ui
Assembly
Gloam.Core.Ui.dll

Main GUI renderer responsible for managing and rendering GUI controls

public class GuiRenderer : IGuiRenderer
Inheritance
GuiRenderer
Implements
Inherited Members

Constructors

GuiRenderer()

Initializes a new instance of GuiRenderer

public GuiRenderer()

Methods

AddControl(IGuiControl)

Adds a GUI control to be managed by this renderer

public void AddControl(IGuiControl control)

Parameters

control IGuiControl

The control to add

ClearClipRegion()

Clears the current clipping region

public void ClearClipRegion()

DrawRectangle(Position, Size, Color)

Renders the outline of a rectangle

public void DrawRectangle(Position position, Size size, Color color)

Parameters

position Position

The position of the rectangle

size Size

The size of the rectangle

color Color

The color of the outline

DrawText(string, Position, Color)

Renders text at the specified position

public void DrawText(string text, Position position, Color color)

Parameters

text string

The text to render

position Position

The position to render at

color Color

The color of the text

FillRectangle(Position, Size, Color)

Renders a filled rectangle

public void FillRectangle(Position position, Size size, Color color)

Parameters

position Position

The position of the rectangle

size Size

The size of the rectangle

color Color

The color to fill with

GetControlAt(Position)

Gets the control at the specified position (hit testing)

public IGuiControl? GetControlAt(Position position)

Parameters

position Position

The position to test

Returns

IGuiControl

The topmost control at the position or null

GetFocusedControl()

Gets the currently focused control

public IGuiControl? GetFocusedControl()

Returns

IGuiControl

The focused control or null

RemoveControl(IGuiControl)

Removes a GUI control from this renderer

public bool RemoveControl(IGuiControl control)

Parameters

control IGuiControl

The control to remove

Returns

bool

True if the control was removed

RenderControls()

Renders all managed controls

public void RenderControls()

SetClipRegion(Rectangle)

Sets the clipping region for rendering

public void SetClipRegion(Rectangle rectangle)

Parameters

rectangle Rectangle

The clipping rectangle

SetFocus(IGuiControl?)

Sets focus to a specific control

public void SetFocus(IGuiControl? control)

Parameters

control IGuiControl

The control to focus (null to clear focus)

SetRenderer(IRenderer)

Sets the renderer to use for drawing (called from the render context)

public void SetRenderer(IRenderer renderer)

Parameters

renderer IRenderer

The renderer to use

UpdateControls(IInputDevice, TimeSpan)

Updates all managed controls (handles input and state changes)

public void UpdateControls(IInputDevice inputDevice, TimeSpan deltaTime)

Parameters

inputDevice IInputDevice

The input device for processing user input

deltaTime TimeSpan

Time elapsed since last update