Table of Contents

Class Controller

Namespace
Fantas.Input
Assembly
Fantas.dll

Controller represent one physical GamePad attached to the system

public sealed class Controller
Inheritance
Controller
Inherited Members

Properties

AnyButtonPressed

Return true if any controller button was just pressed

public bool AnyButtonPressed { get; }

Property Value

bool

AnyButtonReleased

Return true if any controller button was just released

public bool AnyButtonReleased { get; }

Property Value

bool

CurrentButtonsState

Get combined button states

public ControllerButtons CurrentButtonsState { get; }

Property Value

ControllerButtons

DisplayName

Controller display name

public string DisplayName { get; }

Property Value

string

HasAButton

Return true if has A button

public bool HasAButton { get; }

Property Value

bool

HasBButton

Return true if has B button

public bool HasBButton { get; }

Property Value

bool

HasLeftShoulderButton

Check if the Game Controller has left shoulder button

public bool HasLeftShoulderButton { get; }

Property Value

bool

HasLeftThumbstick

Check if the Game Controller has left thumbstick

public bool HasLeftThumbstick { get; }

Property Value

bool

HasLeftThumbstickButton

Check if the Game Controller has left thumbstick Button

public bool HasLeftThumbstickButton { get; }

Property Value

bool

HasLeftTriggerButton

Check if the Game Controller has left trigger Button

public bool HasLeftTriggerButton { get; }

Property Value

bool

HasMenuButton

Check if the Game Controller has Menu/Start button

public bool HasMenuButton { get; }

Property Value

bool

HasOptionsButton

Check if the Game Controller has Options/Back button

public bool HasOptionsButton { get; }

Property Value

bool

HasRightShoulderButton

Check if the Game controller has right shoulder button

public bool HasRightShoulderButton { get; }

Property Value

bool

HasRightThumbstick

Check if the Game Controller has right thumbstick

public bool HasRightThumbstick { get; }

Property Value

bool

HasRightThumbstickButton

Check if the Game Controller has Right Thumbstick button

public bool HasRightThumbstickButton { get; }

Property Value

bool

HasRightTriggerButton

Check if the Game Controller has right trigger Button

public bool HasRightTriggerButton { get; }

Property Value

bool

HasXButton

Return true if has X button

public bool HasXButton { get; }

Property Value

bool

HasYButton

Return true if has Y button

public bool HasYButton { get; }

Property Value

bool

Index

Get controller index

public int Index { get; }

Property Value

int

IsConnected

Check if the controller is connected

public bool IsConnected { get; }

Property Value

bool

LeftThumbstickValue

Left thumbstick position value

public Vector2 LeftThumbstickValue { get; }

Property Value

Vector2

LeftTriggerValue

Left trigger pressed value

public float LeftTriggerValue { get; }

Property Value

float

RightThumbstickValue

Right thumbstick position value

public Vector2 RightThumbstickValue { get; }

Property Value

Vector2

RightTriggerValue

Right trigger value

public float RightTriggerValue { get; }

Property Value

float

Methods

IsButtonDown(ControllerButtons)

Return true if the given button is current pressed

public bool IsButtonDown(ControllerButtons button)

Parameters

button ControllerButtons

Controller Button (A, B, X, Y, etc)

Returns

bool

Return true if the given button is current pressed

IsButtonPressed(ControllerButtons)

Return true if the given button was just pressed

public bool IsButtonPressed(ControllerButtons button)

Parameters

button ControllerButtons

Controller Button (A, B, X, Y, etc)

Returns

bool

Return true if the given button was just pressed

IsButtonReleased(ControllerButtons)

Return true if the given button was just released

public bool IsButtonReleased(ControllerButtons button)

Parameters

button ControllerButtons

Controller Button (A, B, X, Y, etc)

Returns

bool

IsButtonUp(ControllerButtons)

Return true if the given button is current released

public bool IsButtonUp(ControllerButtons button)

Parameters

button ControllerButtons

Controller Button (A, B, X, Y, etc)

Returns

bool

Return true if the given button is current released

SetVibration(float, float)

Vibrate the Controller (if available)

public void SetVibration(float leftMotor, float rightMotor)

Parameters

leftMotor float
rightMotor float

Events

Connected

Notification when Controller is connected or disconnected.

public event EventHandler<ControllerChangedEventArgs> Connected

Event Type

EventHandler<ControllerChangedEventArgs>

Disconnected

Notification when Controller lost its connection

public event EventHandler<ControllerChangedEventArgs> Disconnected

Event Type

EventHandler<ControllerChangedEventArgs>