Popcorning Guinea Pig
Search Results for

    Show / Hide Table of Contents

    Class Text

    A text input control that allows users to enter and edit text

    Inheritance
    object
    UIElementBase
    InteractiveUIElement
    Text
    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.UpdateTooltipFromLocalization()
    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 Text : InteractiveUIElement, IUIElement

    Constructors

    | Edit this page View Source

    Text(Vector2, Vector2, string)

    Constructor for the Text control

    Declaration
    public Text(Vector2 position, Vector2 size, string initialText = "")
    Parameters
    Type Name Description
    Vector2 position

    Position of the control

    Vector2 size

    Size of the control

    string initialText

    Initial text content

    Methods

    | Edit this page View Source

    DrawSelf()

    Override DrawSelf to render the text control

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

    Focus()

    Manually focuses the text control

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

    GetText()

    Gets the current text content

    Declaration
    public string GetText()
    Returns
    Type Description
    string

    The current text

    | Edit this page View Source

    IsFocused()

    Gets whether the control is currently focused

    Declaration
    public bool IsFocused()
    Returns
    Type Description
    bool

    True if focused, false otherwise

    | Edit this page View Source

    SetColors(Color, Color, Color, Color)

    Sets the visual colors for the text control

    Declaration
    public void SetColors(Color backgroundColor, Color textColor, Color borderColor, Color focusedBorderColor)
    Parameters
    Type Name Description
    Color backgroundColor

    Background color

    Color textColor

    Text color

    Color borderColor

    Border color when not focused

    Color focusedBorderColor

    Border color when focused

    | Edit this page View Source

    SetFontSize(int)

    Sets the font size for the text

    Declaration
    public void SetFontSize(int fontSize)
    Parameters
    Type Name Description
    int fontSize

    Font size in pixels

    | Edit this page View Source

    SetLocalizationService(ILocalizationService?)

    Sets the localization service for font management

    Declaration
    public override void SetLocalizationService(ILocalizationService? localizationService)
    Parameters
    Type Name Description
    ILocalizationService localizationService

    The localization service to use

    Overrides
    UIElementBase.SetLocalizationService(ILocalizationService?)
    | Edit this page View Source

    SetOnEnterPressed(Action<string>)

    Sets the callback for when Enter is pressed

    Declaration
    public void SetOnEnterPressed(Action<string> callback)
    Parameters
    Type Name Description
    Action<string> callback

    Callback function that receives the current text

    | Edit this page View Source

    SetOnFocusGained(Action)

    Sets the callback for when the control gains focus

    Declaration
    public void SetOnFocusGained(Action callback)
    Parameters
    Type Name Description
    Action callback

    Callback function

    | Edit this page View Source

    SetOnFocusLost(Action)

    Sets the callback for when the control loses focus

    Declaration
    public void SetOnFocusLost(Action callback)
    Parameters
    Type Name Description
    Action callback

    Callback function

    | Edit this page View Source

    SetOnTextChanged(Action<string>)

    Sets the callback for when text changes

    Declaration
    public void SetOnTextChanged(Action<string> callback)
    Parameters
    Type Name Description
    Action<string> callback

    Callback function that receives the new text

    | Edit this page View Source

    SetPadding(int)

    Sets the padding inside the control

    Declaration
    public void SetPadding(int padding)
    Parameters
    Type Name Description
    int padding

    Padding in pixels

    | Edit this page View Source

    SetText(string)

    Sets the text content of the control

    Declaration
    public void SetText(string text)
    Parameters
    Type Name Description
    string text

    The new text content

    | Edit this page View Source

    Unfocus()

    Manually unfocuses the text control

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

    UpdateSelf()

    Override UpdateSelf to handle text input logic

    Declaration
    protected override void UpdateSelf()
    Overrides
    InteractiveUIElement.UpdateSelf()

    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.