Struct InputKey
Represents a unique input key combining device type, key code, modifiers, and device index. Uses value semantics for efficient dictionary lookups and comparisons.
Implements
Inherited Members
Namespace: PopcorningGuineaPig.Engine.Input
Assembly: PopcorningGuineaPig.Engine.dll
Syntax
public struct InputKey : IEquatable<InputKey>
Properties
| Edit this page View SourceCode
The specific key/button code for this input.
Declaration
public readonly int Code { get; }
Property Value
| Type | Description |
|---|---|
| int |
DeviceIndex
Device index for multiple devices (primarily used for gamepads).
Declaration
public readonly int DeviceIndex { get; }
Property Value
| Type | Description |
|---|---|
| int |
Modifiers
Input modifiers (Ctrl, Shift, Alt) applied to this input.
Declaration
public readonly InputModifiers Modifiers { get; }
Property Value
| Type | Description |
|---|---|
| InputModifiers |
Type
The type of input device (Keyboard, Mouse, Gamepad).
Declaration
public readonly InputType Type { get; }
Property Value
| Type | Description |
|---|---|
| InputType |
Methods
| Edit this page View SourceEquals(InputKey)
Checks equality between two InputKey instances.
Declaration
public bool Equals(InputKey other)
Parameters
| Type | Name | Description |
|---|---|---|
| InputKey | other |
Returns
| Type | Description |
|---|---|
| bool |
Equals(object)
Checks equality with any object.
Declaration
public override bool Equals(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| object | obj |
Returns
| Type | Description |
|---|---|
| bool |
Overrides
| Edit this page View SourceGamepad(GamepadButton, int)
Creates a gamepad input key.
Declaration
public static InputKey Gamepad(GamepadButton button, int deviceIndex = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| GamepadButton | button | The gamepad button |
| int | deviceIndex | The gamepad device index (0-3) |
Returns
| Type | Description |
|---|---|
| InputKey | A new InputKey representing the gamepad input |
GamepadAxis(GamepadAxis, int)
Gamepad axis as a digital key (pressed while past threshold). Used for triggers.
Declaration
public static InputKey GamepadAxis(GamepadAxis axis, int deviceIndex = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| GamepadAxis | axis | |
| int | deviceIndex |
Returns
| Type | Description |
|---|---|
| InputKey |
GetHashCode()
Generates a hash code for efficient dictionary lookups.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| int |
Overrides
| Edit this page View SourceKeyboard(KeyboardKey, InputModifiers)
Creates a keyboard input key.
Declaration
public static InputKey Keyboard(KeyboardKey key, InputModifiers modifiers = InputModifiers.None)
Parameters
| Type | Name | Description |
|---|---|---|
| KeyboardKey | key | The keyboard key |
| InputModifiers | modifiers | Optional modifiers (Ctrl, Shift, Alt) |
Returns
| Type | Description |
|---|---|
| InputKey | A new InputKey representing the keyboard input |
Mouse(MouseButton, InputModifiers)
Creates a mouse input key.
Declaration
public static InputKey Mouse(MouseButton button, InputModifiers modifiers = InputModifiers.None)
Parameters
| Type | Name | Description |
|---|---|---|
| MouseButton | button | The mouse button |
| InputModifiers | modifiers | Optional modifiers (Ctrl, Shift, Alt) |
Returns
| Type | Description |
|---|---|
| InputKey | A new InputKey representing the mouse input |
ToString()
Returns a string representation of the input key.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string |
Overrides
Operators
| Edit this page View Sourceoperator ==(InputKey, InputKey)
Equality operator.
Declaration
public static bool operator ==(InputKey left, InputKey right)
Parameters
| Type | Name | Description |
|---|---|---|
| InputKey | left | |
| InputKey | right |
Returns
| Type | Description |
|---|---|
| bool |
operator !=(InputKey, InputKey)
Inequality operator.
Declaration
public static bool operator !=(InputKey left, InputKey right)
Parameters
| Type | Name | Description |
|---|---|---|
| InputKey | left | |
| InputKey | right |
Returns
| Type | Description |
|---|---|
| bool |