Class InputBinding
Represents a binding between an input and a command. Defines how input events are mapped to command execution.
Inherited Members
Namespace: PopcorningGuineaPig.Engine.Input
Assembly: PopcorningGuineaPig.Engine.dll
Syntax
public class InputBinding
Constructors
| Edit this page View SourceInputBinding()
Creates a new input binding.
Declaration
public InputBinding()
InputBinding(string, InputKey, IInputCommand, InputTriggerType, bool)
Creates a new input binding with the specified properties.
Declaration
public InputBinding(string id, InputKey inputKey, IInputCommand command, InputTriggerType triggerType = InputTriggerType.Pressed, bool enabled = true)
Parameters
| Type | Name | Description |
|---|---|---|
| string | id | Unique identifier for the binding |
| InputKey | inputKey | The input key that triggers this binding |
| IInputCommand | command | The command to execute |
| InputTriggerType | triggerType | How the input trigger is handled |
| bool | enabled | Whether the binding is enabled |
Properties
| Edit this page View SourceCommand
The command to execute when the input is triggered.
Declaration
public IInputCommand Command { get; set; }
Property Value
| Type | Description |
|---|---|
| IInputCommand |
Enabled
Whether this binding is currently enabled.
Declaration
public bool Enabled { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Id
Unique identifier for this binding.
Declaration
public string Id { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
InputKey
The input key that triggers this binding.
Declaration
public InputKey InputKey { get; set; }
Property Value
| Type | Description |
|---|---|
| InputKey |
Parameters
Optional parameters to pass to the command when executed.
Declaration
public object[] Parameters { get; set; }
Property Value
| Type | Description |
|---|---|
| object[] |
RepeatDelay
Delay before repeat triggers start (in seconds). Only used with TriggerType.Repeat.
Declaration
public float RepeatDelay { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
RepeatRate
Rate of repeat triggers (in seconds between triggers). Only used with TriggerType.Repeat.
Declaration
public float RepeatRate { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
TriggerType
How the input trigger is handled (Pressed, Released, Held, Repeat).
Declaration
public InputTriggerType TriggerType { get; set; }
Property Value
| Type | Description |
|---|---|
| InputTriggerType |
Methods
| Edit this page View SourceExecute()
Executes the bound command if the binding is enabled.
Declaration
public void Execute()
Matches(InputKey)
Checks if this binding matches the given input key.
Declaration
public bool Matches(InputKey inputKey)
Parameters
| Type | Name | Description |
|---|---|---|
| InputKey | inputKey | The input key to check |
Returns
| Type | Description |
|---|---|
| bool | True if the binding matches the input key |
ToString()
Returns a string representation of the binding.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string |