Popcorning Guinea Pig
Search Results for

    Show / Hide Table of Contents

    Class Button

    Inheritance
    object
    UIElementBase
    InteractiveUIElement
    Button
    Implements
    IUIElement
    Inherited Members
    InteractiveUIElement.IsEnabled
    InteractiveUIElement.LabelPosition
    InteractiveUIElement.HasLabel
    InteractiveUIElement.LabelSpacing
    InteractiveUIElement.GetTotalSizeWithLabel()
    InteractiveUIElement.GetLabelOffset()
    InteractiveUIElement.SetEnabled(bool)
    InteractiveUIElement.GetEnabled()
    InteractiveUIElement.SetLabel(string, LabelPosition, float)
    InteractiveUIElement.SetLabelLocalization(ILocalizationService, string, string)
    InteractiveUIElement.RemoveLabel()
    InteractiveUIElement.GetLabelText()
    UIElementBase._children
    UIElementBase.Tooltip
    UIElementBase.TooltipLocalizationKey
    UIElementBase.TooltipFallbackText
    UIElementBase.Id
    UIElementBase.Position
    UIElementBase.Size
    UIElementBase.Visible
    UIElementBase.Opacity
    UIElementBase.Parent
    UIElementBase.Children
    UIElementBase.AddChild(IUIElement)
    UIElementBase.RemoveChild(IUIElement)
    UIElementBase.RemoveFromParent()
    UIElementBase.GetWorldPosition()
    UIElementBase.GetLocalPosition()
    UIElementBase.Update()
    UIElementBase.Draw()
    UIElementBase.SetTooltip(string)
    UIElementBase.SetTooltipLocalizationKey(string, string)
    UIElementBase.SetTooltipText(string)
    UIElementBase.IsMouseOver()
    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 Button : InteractiveUIElement, IUIElement

    Constructors

    | Edit this page View Source

    Button(Texture2D, Vector2, Vector2, Rectangle[], Font?)

    Declaration
    public Button(Texture2D texture, Vector2 position, Vector2 size, Rectangle[] nineSliceRects, Font? font = null)
    Parameters
    Type Name Description
    Texture2D texture
    Vector2 position
    Vector2 size
    Rectangle[] nineSliceRects
    Font? font
    | Edit this page View Source

    Button(Texture2D, Vector2, Vector2, Font?)

    Declaration
    public Button(Texture2D texture, Vector2 position, Vector2 size, Font? font = null)
    Parameters
    Type Name Description
    Texture2D texture
    Vector2 position
    Vector2 size
    Font? font
    | Edit this page View Source

    Button(string, Vector2, Vector2, Color, Font?)

    Declaration
    public Button(string text, Vector2 position, Vector2 size, Color color, Font? font = null)
    Parameters
    Type Name Description
    string text
    Vector2 position
    Vector2 size
    Color color
    Font? font

    Properties

    | Edit this page View Source

    Color

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

    FocusHighlight

    Forced hover from gamepad focus navigation.

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

    FontSize

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

    Text

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

    TextColor

    Declaration
    public Color TextColor { get; set; }
    Property Value
    Type Description
    Color

    Methods

    | Edit this page View Source

    CreateNineSliceRects(Texture2D, int)

    Declaration
    public static Rectangle[] CreateNineSliceRects(Texture2D texture, int cornerSize)
    Parameters
    Type Name Description
    Texture2D texture
    int cornerSize
    Returns
    Type Description
    Rectangle[]
    | Edit this page View Source

    DrawSelf()

    Override DrawSelf to handle label drawing Derived classes should call base.DrawSelf() to ensure labels are drawn

    Declaration
    protected override void DrawSelf()
    Overrides
    InteractiveUIElement.DrawSelf()
    | Edit this page View Source

    InvokeClick()

    Fire the click action (gamepad focus confirm).

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

    SetClickSound(IAudioSource)

    Declaration
    public void SetClickSound(IAudioSource sound)
    Parameters
    Type Name Description
    IAudioSource sound
    | Edit this page View Source

    SetColors(Color, Color, Color)

    Declaration
    public void SetColors(Color normal, Color hover, Color pressed)
    Parameters
    Type Name Description
    Color normal
    Color hover
    Color pressed
    | Edit this page View Source

    SetFont(Font)

    Declaration
    public void SetFont(Font font)
    Parameters
    Type Name Description
    Font font
    | Edit this page View Source

    SetHoverSound(IAudioSource)

    Declaration
    public void SetHoverSound(IAudioSource sound)
    Parameters
    Type Name Description
    IAudioSource sound
    | Edit this page View Source

    SetLocalizationKey(string, string?)

    Sets the localization key for automatic text updates when language changes.

    Declaration
    public void SetLocalizationKey(string localizationKey, string? fallbackText = null)
    Parameters
    Type Name Description
    string localizationKey

    The localization key (e.g., "TUTORIAL")

    string fallbackText

    Text to use if translation fails

    | Edit this page View Source

    SetLocalizationService(ILocalizationService?)

    Sets the localization service to use for automatic font and text management.

    Declaration
    public override void SetLocalizationService(ILocalizationService? localizationService)
    Parameters
    Type Name Description
    ILocalizationService localizationService
    Overrides
    UIElementBase.SetLocalizationService(ILocalizationService?)
    | Edit this page View Source

    SetOnClick(Action)

    Declaration
    public void SetOnClick(Action action)
    Parameters
    Type Name Description
    Action action
    | Edit this page View Source

    SetPosition(Vector2)

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

    SetSize(Vector2)

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

    SetText(string)

    Declaration
    public void SetText(string text)
    Parameters
    Type Name Description
    string text
    | Edit this page View Source

    SetTextProperties(int, Color)

    Declaration
    public void SetTextProperties(int fontSize, Color textColor)
    Parameters
    Type Name Description
    int fontSize
    Color textColor
    | Edit this page View Source

    SetTexture(Texture2D, Rectangle[]?)

    Attach (or replace) a background texture after construction. Pass nine-slice rectangles (exactly 9, e.g. from CreateNineSliceRects(Texture2D, int)) to draw as a nine-patch; pass null to draw the texture stretched.

    Declaration
    public void SetTexture(Texture2D texture, Rectangle[]? nineSliceRects = null)
    Parameters
    Type Name Description
    Texture2D texture
    Rectangle[] nineSliceRects
    | Edit this page View Source

    UpdateSelf()

    Override UpdateSelf to provide common interactive element functionality Derived classes should call base.UpdateSelf() before their own update logic

    Declaration
    protected override void UpdateSelf()
    Overrides
    InteractiveUIElement.UpdateSelf()
    | Edit this page View Source

    UpdateTooltipFromLocalization()

    Updates the tooltip text from the localization service using the stored tooltip localization key.

    Declaration
    protected override void UpdateTooltipFromLocalization()
    Overrides
    UIElementBase.UpdateTooltipFromLocalization()

    Implements

    IUIElement
    • 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.