Table of Contents

Class InputBinding

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

Represents a binding between an input and a command. Defines how input events are mapped to command execution.

public class InputBinding
Inheritance
InputBinding
Inherited Members

Constructors

InputBinding()

Creates a new input binding.

public InputBinding()

InputBinding(string, InputKey, IInputCommand, InputTriggerType, bool)

Creates a new input binding with the specified properties.

public InputBinding(string id, InputKey inputKey, IInputCommand command, InputTriggerType triggerType = InputTriggerType.Pressed, bool enabled = true)

Parameters

id string

Unique identifier for the binding

inputKey InputKey

The input key that triggers this binding

command IInputCommand

The command to execute

triggerType InputTriggerType

How the input trigger is handled

enabled bool

Whether the binding is enabled

Properties

Command

The command to execute when the input is triggered.

public IInputCommand Command { get; set; }

Property Value

IInputCommand

Enabled

Whether this binding is currently enabled.

public bool Enabled { get; set; }

Property Value

bool

Id

Unique identifier for this binding.

public string Id { get; set; }

Property Value

string

InputKey

The input key that triggers this binding.

public InputKey InputKey { get; set; }

Property Value

InputKey

Parameters

Optional parameters to pass to the command when executed.

public object[] Parameters { get; set; }

Property Value

object[]

RepeatDelay

Delay before repeat triggers start (in seconds). Only used with TriggerType.Repeat.

public float RepeatDelay { get; set; }

Property Value

float

RepeatRate

Rate of repeat triggers (in seconds between triggers). Only used with TriggerType.Repeat.

public float RepeatRate { get; set; }

Property Value

float

TriggerType

How the input trigger is handled (Pressed, Released, Held, Repeat).

public InputTriggerType TriggerType { get; set; }

Property Value

InputTriggerType

Methods

Execute()

Executes the bound command if the binding is enabled.

public void Execute()

Matches(InputKey)

Checks if this binding matches the given input key.

public bool Matches(InputKey inputKey)

Parameters

inputKey InputKey

The input key to check

Returns

bool

True if the binding matches the input key

ToString()

Returns a string representation of the binding.

public override string ToString()

Returns

string