Table of Contents

Class GamePadDeviceBase

Namespace
Stride.Input
Assembly
Stride.Input.dll
public abstract class GamePadDeviceBase : IGamePadDevice, IInputDevice
Inheritance
GamePadDeviceBase
Implements
Derived
Extension Methods

Constructors

GamePadDeviceBase()

protected GamePadDeviceBase()

Properties

CanChangeIndex

true if the index of this gamepad can be changed

public bool CanChangeIndex { get; protected set; }

Property Value

bool

DownButtons

The gamepad buttons that are down

public IReadOnlySet<GamePadButton> DownButtons { get; }

Property Value

IReadOnlySet<GamePadButton>

Id

The unique identifier of this device

public abstract Guid Id { get; }

Property Value

Guid

Index

The index of the gamepad assigned by the input manager

public int Index { get; set; }

Property Value

int

Remarks

If CanChangeIndex is false, this value can not be changed

Name

The name of the device

public abstract string Name { get; }

Property Value

string

PressedButtons

The gamepad buttons that have been pressed since the last frame

public IReadOnlySet<GamePadButton> PressedButtons { get; }

Property Value

IReadOnlySet<GamePadButton>

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 abstract Guid ProductId { get; }

Property Value

Guid

ReleasedButtons

The gamepad buttons that have been released since the last frame

public IReadOnlySet<GamePadButton> ReleasedButtons { get; }

Property Value

IReadOnlySet<GamePadButton>

Source

The input source the device belongs to.

public abstract IInputSource Source { get; }

Property Value

IInputSource

State

The state of the gamepad

public abstract GamePadState State { get; }

Property Value

GamePadState

Methods

ClearButtonStates()

Clears previous Pressed/Released states

protected void ClearButtonStates()

SetIndexInternal(int, bool)

protected void SetIndexInternal(int newIndex, bool isDeviceSideChange = true)

Parameters

newIndex int
isDeviceSideChange bool

SetVibration(float, float, float, float)

Sets 4 vibration motors one the device or approximates the effect if less are supported

public abstract void SetVibration(float smallLeft, float smallRight, float largeLeft, float largeRight)

Parameters

smallLeft float

The small left side motor

smallRight float

The small right side motor

largeLeft float

The large left side motor

largeRight float

The large right side motor

Remarks

Values range from 0 to 1, where 0 is off and 1 is maximum vibration

Update(List<InputEvent>)

Updates the input device, filling the list inputEvents with input events that were generated by this device this frame

public abstract void Update(List<InputEvent> inputEvents)

Parameters

inputEvents List<InputEvent>

A list that gets filled with input events that were generated since the last frame

Remarks

Input devices are always updated after their respective input source

UpdateButtonState(GamePadButtonEvent)

Updates Pressed/Released/Down collections

protected void UpdateButtonState(GamePadButtonEvent evt)

Parameters

evt GamePadButtonEvent

Events

IndexChanged

Raised if the index assigned to this gamepad changed

public event EventHandler<GamePadIndexChangedEventArgs> IndexChanged

Event Type

EventHandler<GamePadIndexChangedEventArgs>