Table of Contents

Class InputContext

Namespace
PopcorningGuineaPig.Engine.Input
Assembly
PopcorningGuineaPig.Engine.dll

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

public class InputContext
Inheritance
InputContext
Inherited Members

Constructors

InputContext(string, int, bool)

Creates a new input context.

public InputContext(string name, int priority = 0, bool allowPassthrough = true)

Parameters

name string

Name of the context

priority int

Priority of the context (higher = more important)

allowPassthrough bool

Whether to allow input passthrough

Properties

AllowPassthrough

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

public bool AllowPassthrough { get; set; }

Property Value

bool

BindingCount

Gets the number of bindings in this context.

public int BindingCount { get; }

Property Value

int

Bindings

Collection of all bindings in this context.

public IReadOnlyDictionary<InputKey, InputBinding> Bindings { get; }

Property Value

IReadOnlyDictionary<InputKey, InputBinding>

Name

Name of this input context.

public string Name { get; set; }

Property Value

string

Priority

Priority of this context. Higher values have higher priority.

public int Priority { get; set; }

Property Value

int

Methods

AddBinding(InputBinding)

Adds a binding to this context.

public void AddBinding(InputBinding binding)

Parameters

binding InputBinding

The binding to add

ClearBindings()

Clears all bindings from this context.

public void ClearBindings()

GetBinding(InputKey)

Gets a binding by input key.

public InputBinding GetBinding(InputKey inputKey)

Parameters

inputKey InputKey

The input key to look up

Returns

InputBinding

The binding if found, null otherwise

GetBindingById(string)

Gets a binding by ID.

public InputBinding GetBindingById(string bindingId)

Parameters

bindingId string

The binding ID to look up

Returns

InputBinding

The binding if found, null otherwise

GetMatchingBindings(InputKey)

Gets all bindings that match the specified input key.

public IEnumerable<InputBinding> GetMatchingBindings(InputKey inputKey)

Parameters

inputKey InputKey

The input key to match

Returns

IEnumerable<InputBinding>

Collection of matching bindings

HandlesInput(InputKey)

Checks if this context handles the specified input key.

public bool HandlesInput(InputKey inputKey)

Parameters

inputKey InputKey

The input key to check

Returns

bool

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

RemoveBinding(string)

Removes a binding by ID.

public bool RemoveBinding(string bindingId)

Parameters

bindingId string

ID of the binding to remove

Returns

bool

True if the binding was removed, false if not found

ToString()

Returns a string representation of the context.

public override string ToString()

Returns

string