Popcorning Guinea Pig
Search Results for

    Show / Hide Table of Contents

    Class InputContext

    Represents a context for input bindings with priority-based resolution. Input contexts allow for scene-specific or layered input handling.

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

    Constructors

    | Edit this page View Source

    InputContext(string, int, bool)

    Creates a new input context.

    Declaration
    public InputContext(string name, int priority = 0, bool allowPassthrough = true)
    Parameters
    Type Name Description
    string name

    Name of the context

    int priority

    Priority of the context (higher = more important)

    bool allowPassthrough

    Whether to allow input passthrough

    Properties

    | Edit this page View Source

    AllowPassthrough

    Whether input should pass through to lower priority contexts if not handled.

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

    BindingCount

    Gets the number of bindings in this context.

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

    Bindings

    Collection of all bindings in this context.

    Declaration
    public IReadOnlyDictionary<InputKey, InputBinding> Bindings { get; }
    Property Value
    Type Description
    IReadOnlyDictionary<InputKey, InputBinding>
    | Edit this page View Source

    Name

    Name of this input context.

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

    Priority

    Priority of this context. Higher values have higher priority.

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

    Methods

    | Edit this page View Source

    AddBinding(InputBinding)

    Adds a binding to this context.

    Declaration
    public void AddBinding(InputBinding binding)
    Parameters
    Type Name Description
    InputBinding binding

    The binding to add

    | Edit this page View Source

    ClearBindings()

    Clears all bindings from this context.

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

    GetBinding(InputKey)

    Gets a binding by input key.

    Declaration
    public InputBinding GetBinding(InputKey inputKey)
    Parameters
    Type Name Description
    InputKey inputKey

    The input key to look up

    Returns
    Type Description
    InputBinding

    The binding if found, null otherwise

    | Edit this page View Source

    GetBindingById(string)

    Gets a binding by ID.

    Declaration
    public InputBinding GetBindingById(string bindingId)
    Parameters
    Type Name Description
    string bindingId

    The binding ID to look up

    Returns
    Type Description
    InputBinding

    The binding if found, null otherwise

    | Edit this page View Source

    GetMatchingBindings(InputKey)

    Gets all bindings that match the specified input key.

    Declaration
    public IEnumerable<InputBinding> GetMatchingBindings(InputKey inputKey)
    Parameters
    Type Name Description
    InputKey inputKey

    The input key to match

    Returns
    Type Description
    IEnumerable<InputBinding>

    Collection of matching bindings

    | Edit this page View Source

    HandlesInput(InputKey)

    Checks if this context handles the specified input key.

    Declaration
    public bool HandlesInput(InputKey inputKey)
    Parameters
    Type Name Description
    InputKey inputKey

    The input key to check

    Returns
    Type Description
    bool

    True if the context has an enabled binding for the input key

    | Edit this page View Source

    RemoveBinding(string)

    Removes a binding by ID.

    Declaration
    public bool RemoveBinding(string bindingId)
    Parameters
    Type Name Description
    string bindingId

    ID of the binding to remove

    Returns
    Type Description
    bool

    True if the binding was removed, false if not found

    | Edit this page View Source

    ToString()

    Returns a string representation of the context.

    Declaration
    public override string ToString()
    Returns
    Type Description
    string
    Overrides
    object.ToString()
    • 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.