Table of Contents

Class HudParentBase

Namespace
RichHudFramework.UI
Assembly
RichHudClient.dll

Abstract base for HUD elements to which other elements are parented. Types deriving from this class cannot be parented to other elements; only types of HudNodeBase can be parented.

public abstract class HudParentBase : IReadOnlyHudParent
Inheritance
HudParentBase
Implements
Derived

Remarks

HudParentBase serves as the fundamental base class for all components capable of serving as parent nodes in the UI tree. It defines the core lifecycle hooks for the framework's update loop, including Measure, Layout, Draw, and input handling.

Unlike its derived types, this class represents a root-level object; types deriving strictly from HudParentBase cannot be parented to other elements. Consequently, it is primarily used as the foundation for the framework's global root nodes, such as Root and HighDpiRoot, which serve as the anchors for the entire UI node graph.

Note

It is generally not recommended to extend this type directly for custom controls. In standard usage, HudElementBase should be used as the base type for creating custom UI elements, as it includes the necessary logic for sizing, positioning, and parenting.

Constructors

HudParentBase()

public HudParentBase()

Properties

HudSpace

Node defining the coordinate space used to render the UI element

public virtual IReadOnlyHudSpaceNode HudSpace { get; protected set; }

Property Value

IReadOnlyHudSpaceNode

InputEnabled

Returns true if input is enabled

public bool InputEnabled { get; set; }

Property Value

bool

Visible

Returns true if the element is enabled and able to be drawn and accept input.

public bool Visible { get; set; }

Property Value

bool

ZOffset

Moves the UI element up or down in draw order. -1 will draw an element behind its immediate parent. +1 will draw it on top of siblings. Higher values will allow it to draw behind or over more distantly related elements.

public sbyte ZOffset { get; set; }

Property Value

sbyte

Methods

Draw()

Custom drawing hook. Useful for drawing custom billboards.

Updates in back-to-front order after Layout(), with elements on the bottom drawing first, and elements in front drawing last.

protected virtual void Draw()

HandleInput(Vector2)

Input polling hook.

Updates in front-to-back order after InputDepth(), with elements on top updating first, and elements in the back updating last.

protected virtual void HandleInput(Vector2 cursorPos)

Parameters

cursorPos Vector2

InputDepth()

Update hook for testing cursor bounding and depth tests.

Updates in back-to-front order after Draw(). Elements on the bottom update first, and elements on top update last.

protected virtual void InputDepth()

Layout()

Custom element arrangement/layout hook. Used for sizing and arranging child nodes within the bounds of the element.

Custom Layout updates should be designed to respect any size that may be set by a parent, whether it implements UpdateSize() or not.

Updates in top-down order, after UpdateSize().

protected virtual void Layout()

Measure()

Automatic self-resizing and measurement hook. Required for correct and stable self-resizing. Unnecessary for elements that don't need to set their own size.

Updates in bottom-up order before anything else, with elements at the bottom of the node heirarchy (furthest from root) updating first, and nodes at the top (closer to root) updating last.

protected virtual void Measure()

RegisterChild(HudNodeBase)

Registers a child node to the parent.

public virtual bool RegisterChild(HudNodeBase child)

Parameters

child HudNodeBase

Returns

bool

RemoveChild(HudNodeBase)

Unregisters the specified node from the parent.

public virtual bool RemoveChild(HudNodeBase child)

Parameters

child HudNodeBase

Returns

bool