Popcorning Guinea Pig
Search Results for

    Show / Hide Table of Contents

    Class UIHierarchyNode

    Hierarchical wrapper that can contain existing UI elements and provide parent-child relationships for the PGPSCN system.

    Inheritance
    object
    UIHierarchyNode
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: PopcorningGuineaPig.Engine.UI
    Assembly: PopcorningGuineaPig.Engine.dll
    Syntax
    public class UIHierarchyNode

    Properties

    | Edit this page View Source

    Children

    Declaration
    public List<UIHierarchyNode> Children { get; }
    Property Value
    Type Description
    List<UIHierarchyNode>
    | Edit this page View Source

    Id

    Declaration
    public string Id { get; set; }
    Property Value
    Type Description
    string
    | Edit this page View Source

    IsEffectivelyVisible

    Gets the effective visibility (this element and all parents must be visible)

    Declaration
    public bool IsEffectivelyVisible { get; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    LocalPosition

    Declaration
    public Vector2 LocalPosition { get; set; }
    Property Value
    Type Description
    Vector2
    | Edit this page View Source

    Parent

    Declaration
    public UIHierarchyNode? Parent { get; set; }
    Property Value
    Type Description
    UIHierarchyNode
    | Edit this page View Source

    Size

    Declaration
    public Vector2 Size { get; set; }
    Property Value
    Type Description
    Vector2
    | Edit this page View Source

    UIElement

    Declaration
    public object? UIElement { get; set; }
    Property Value
    Type Description
    object
    | Edit this page View Source

    Visible

    Declaration
    public bool Visible { get; set; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    WorldBounds

    Gets the world bounds rectangle for this element

    Declaration
    public Rectangle WorldBounds { get; }
    Property Value
    Type Description
    Rectangle
    | Edit this page View Source

    WorldPosition

    Gets the world position by combining this element's local position with all parent positions

    Declaration
    public Vector2 WorldPosition { get; }
    Property Value
    Type Description
    Vector2
    | Edit this page View Source

    ZIndex

    Declaration
    public int ZIndex { get; set; }
    Property Value
    Type Description
    int

    Methods

    | Edit this page View Source

    AddChild(UIHierarchyNode)

    Adds a child element to this element

    Declaration
    public virtual void AddChild(UIHierarchyNode child)
    Parameters
    Type Name Description
    UIHierarchyNode child
    | Edit this page View Source

    ContainsPoint(Vector2)

    Checks if a world point is within this element's bounds

    Declaration
    public bool ContainsPoint(Vector2 worldPoint)
    Parameters
    Type Name Description
    Vector2 worldPoint
    Returns
    Type Description
    bool
    | Edit this page View Source

    Draw()

    Renders this element and all children

    Declaration
    public virtual void Draw()
    | Edit this page View Source

    FindElementAt(Vector2)

    Finds the deepest child element that contains the given world point

    Declaration
    public UIHierarchyNode? FindElementAt(Vector2 worldPoint)
    Parameters
    Type Name Description
    Vector2 worldPoint
    Returns
    Type Description
    UIHierarchyNode
    | Edit this page View Source

    GetAllChildren()

    Gets all child elements recursively, sorted by Z-index

    Declaration
    public IEnumerable<UIHierarchyNode> GetAllChildren()
    Returns
    Type Description
    IEnumerable<UIHierarchyNode>
    | Edit this page View Source

    GetPathToRoot()

    Gets the path from this element to the root parent

    Declaration
    public List<UIHierarchyNode> GetPathToRoot()
    Returns
    Type Description
    List<UIHierarchyNode>
    | Edit this page View Source

    LocalToWorld(Vector2)

    Converts a local coordinate to world coordinate

    Declaration
    public Vector2 LocalToWorld(Vector2 localPoint)
    Parameters
    Type Name Description
    Vector2 localPoint
    Returns
    Type Description
    Vector2
    | Edit this page View Source

    OnParentChanged()

    Called when this element's parent changes

    Declaration
    protected virtual void OnParentChanged()
    | Edit this page View Source

    RemoveChild(UIHierarchyNode)

    Removes a child element from this element

    Declaration
    public virtual void RemoveChild(UIHierarchyNode child)
    Parameters
    Type Name Description
    UIHierarchyNode child
    | Edit this page View Source

    SetLocalPosition(Vector2)

    Sets the local position of this element and updates the underlying UI element

    Declaration
    public virtual void SetLocalPosition(Vector2 position)
    Parameters
    Type Name Description
    Vector2 position
    | Edit this page View Source

    SetSize(Vector2)

    Sets the size of this element

    Declaration
    public virtual void SetSize(Vector2 size)
    Parameters
    Type Name Description
    Vector2 size
    | Edit this page View Source

    SetVisible(bool, bool)

    Sets the visibility of this element and optionally all children

    Declaration
    public virtual void SetVisible(bool visible, bool recursive = false)
    Parameters
    Type Name Description
    bool visible
    bool recursive
    | Edit this page View Source

    Update(double)

    Updates this element and all children

    Declaration
    public virtual void Update(double deltaTime)
    Parameters
    Type Name Description
    double deltaTime
    | Edit this page View Source

    UpdateUIElementPosition()

    Updates the position of the underlying UI element to match the world position

    Declaration
    public void UpdateUIElementPosition()
    | Edit this page View Source

    WorldToLocal(Vector2)

    Converts a world coordinate to local coordinate relative to this element

    Declaration
    public Vector2 WorldToLocal(Vector2 worldPoint)
    Parameters
    Type Name Description
    Vector2 worldPoint
    Returns
    Type Description
    Vector2
    • Edit this page
    • View Source
    In this article
    Back to top © 2024 Popcorning Guinea Pig Game Engine. A custom C# game engine for indie developers.