Table of Contents

Class GameControllerDeviceBase

Namespace
Stride.Input
Assembly
Stride.Input.dll

Base class for gamepads, contains common functionality for gamepad devices

public abstract class GameControllerDeviceBase : IGameControllerDevice, IInputDevice
Inheritance
GameControllerDeviceBase
Implements
Extension Methods

Constructors

GameControllerDeviceBase()

protected GameControllerDeviceBase()

Fields

AxisStates

protected float[] AxisStates

Field Value

float[]

ButtonStates

protected bool[] ButtonStates

Field Value

bool[]

DirectionStates

protected Direction[] DirectionStates

Field Value

Direction[]

Properties

AxisInfos

Information about the axes on this game controller

public abstract IReadOnlyList<GameControllerAxisInfo> AxisInfos { get; }

Property Value

IReadOnlyList<GameControllerAxisInfo>

ButtonInfos

Information about the buttons on this game controller

public abstract IReadOnlyList<GameControllerButtonInfo> ButtonInfos { get; }

Property Value

IReadOnlyList<GameControllerButtonInfo>

DirectionInfos

Information about the direction controllers on this game controller

public abstract IReadOnlyList<GameControllerDirectionInfo> DirectionInfos { get; }

Property Value

IReadOnlyList<GameControllerDirectionInfo>

DownButtons

The buttons that are down

public IReadOnlySet<int> DownButtons { get; }

Property Value

IReadOnlySet<int>

Id

The unique identifier of this device

public abstract Guid Id { get; }

Property Value

Guid

Name

The name of the device

public abstract string Name { get; }

Property Value

string

PressedButtons

The buttons that have been pressed since the last frame

public IReadOnlySet<int> PressedButtons { get; }

Property Value

IReadOnlySet<int>

Priority

The device priority. Larger means higher priority when selecting the first device of some type

public int Priority { get; set; }

Property Value

int

ProductId

Product Id of the device

public virtual Guid ProductId { get; }

Property Value

Guid

ReleasedButtons

The buttons that have been released since the last frame

public IReadOnlySet<int> ReleasedButtons { get; }

Property Value

IReadOnlySet<int>

Source

The input source the device belongs to.

public abstract IInputSource Source { get; }

Property Value

IInputSource

Methods

GetAxis(int)

Retrieves the state of a single axis

public virtual float GetAxis(int index)

Parameters

index int

The axis' index, as exposed in AxisInfos

Returns

float

The value read directly from the axis

GetDirection(int)

Retrieves the state of a single point of direction controller

public virtual Direction GetDirection(int index)

Parameters

index int

The direction controller's index, as exposed in DirectionInfos

Returns

Direction

The current state of the direction controller

HandleAxis(int, float)

protected void HandleAxis(int index, float state)

Parameters

index int
state float

HandleButton(int, bool)

protected void HandleButton(int index, bool state)

Parameters

index int
state bool

HandleDirection(int, Direction)

protected void HandleDirection(int index, Direction state)

Parameters

index int
state Direction

InitializeButtonStates()

Creates the correct amount of states based on the amount of object infos that are set

protected void InitializeButtonStates()

Update(List<InputEvent>)

Raise gamepad events collected by Handle... functions

public virtual void Update(List<InputEvent> inputEvents)

Parameters

inputEvents List<InputEvent>