Popcorning Guinea Pig
Search Results for

    Show / Hide Table of Contents

    Class ContextStack

    Manages a stack of input contexts with priority-based resolution. Allows for layered input handling (e.g., menus over gameplay).

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

    Constructors

    | Edit this page View Source

    ContextStack()

    Creates a new context stack.

    Declaration
    public ContextStack()

    Methods

    | Edit this page View Source

    Clear()

    Clears all contexts from the stack.

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

    GetActiveContexts()

    Gets all active contexts, including the global context.

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

    GetContext(string)

    Gets a context by name.

    Declaration
    public InputContext GetContext(string contextName)
    Parameters
    Type Name Description
    string contextName

    Name of the context to find

    Returns
    Type Description
    InputContext

    The context if found, null otherwise

    | Edit this page View Source

    Pop(string)

    Pops a context from the stack.

    Declaration
    public InputContext Pop(string contextName)
    Parameters
    Type Name Description
    string contextName

    Name of the context to pop

    Returns
    Type Description
    InputContext

    The popped context, or null if not found

    | Edit this page View Source

    Push(InputContext)

    Pushes a context onto the stack. The stack is sorted by priority after each push.

    Declaration
    public void Push(InputContext context)
    Parameters
    Type Name Description
    InputContext context

    The context to push

    | Edit this page View Source

    ResolveBinding(InputKey)

    Resolves a binding for the given input key by checking contexts in priority order.

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

    The input key to resolve

    Returns
    Type Description
    InputBinding

    The highest priority binding, or null if not found

    | Edit this page View Source

    SetGlobalContext(InputContext)

    Sets the global context.

    Declaration
    public void SetGlobalContext(InputContext context)
    Parameters
    Type Name Description
    InputContext context

    The global context

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