Popcorning Guinea Pig
Search Results for

    Show / Hide Table of Contents

    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
    IEquatable<InputKey>
    Inherited Members
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: PopcorningGuineaPig.Engine.Input
    Assembly: PopcorningGuineaPig.Engine.dll
    Syntax
    public struct InputKey : IEquatable<InputKey>

    Properties

    | Edit this page View Source

    Code

    The specific key/button code for this input.

    Declaration
    public readonly int Code { get; }
    Property Value
    Type Description
    int
    | Edit this page View Source

    DeviceIndex

    Device index for multiple devices (primarily used for gamepads).

    Declaration
    public readonly int DeviceIndex { get; }
    Property Value
    Type Description
    int
    | Edit this page View Source

    Modifiers

    Input modifiers (Ctrl, Shift, Alt) applied to this input.

    Declaration
    public readonly InputModifiers Modifiers { get; }
    Property Value
    Type Description
    InputModifiers
    | Edit this page View Source

    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 Source

    Equals(InputKey)

    Checks equality between two InputKey instances.

    Declaration
    public bool Equals(InputKey other)
    Parameters
    Type Name Description
    InputKey other
    Returns
    Type Description
    bool
    | Edit this page View Source

    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
    ValueType.Equals(object)
    | Edit this page View Source

    Gamepad(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

    | Edit this page View Source

    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
    | Edit this page View Source

    GetHashCode()

    Generates a hash code for efficient dictionary lookups.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int
    Overrides
    ValueType.GetHashCode()
    | Edit this page View Source

    Keyboard(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

    | Edit this page View Source

    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

    | Edit this page View Source

    ToString()

    Returns a string representation of the input key.

    Declaration
    public override string ToString()
    Returns
    Type Description
    string
    Overrides
    ValueType.ToString()

    Operators

    | Edit this page View Source

    operator ==(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
    | Edit this page View Source

    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

    Implements

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