C# Class Steamworks.SteamController

Exibir arquivo Open project: rlabrecque/Steamworks.NET Class Usage Examples

Public Methods

Method Description
ActivateActionSet ( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetHandle ) : void

Reconfigure the controller to use the specified action set (ie 'Menu', 'Walk' or 'Drive')

This is cheap, and can be safely called repeatedly. It's often easier to repeatedly call it in

your state loops, instead of trying to place it in all of your state transitions.

GetActionSetHandle ( string pszActionSetName ) : ControllerActionSetHandle_t

ACTION SETS

Lookup the handle for an Action Set. Best to do this once on startup, and store the handles for all future API calls.

GetAnalogActionData ( ControllerHandle_t controllerHandle, ControllerAnalogActionHandle_t analogActionHandle ) : ControllerAnalogActionData_t

Returns the current state of these supplied analog game action

GetAnalogActionHandle ( string pszActionName ) : ControllerAnalogActionHandle_t

Lookup the handle for an analog action. Best to do this once on startup, and store the handles for all future API calls.

GetAnalogActionOrigins ( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetHandle, ControllerAnalogActionHandle_t analogActionHandle, EControllerActionOrigin originsOut ) : int

Get the origin(s) for an analog action within an action set. Returns the number of origins supplied in originsOut. Use this to display the appropriate on-screen prompt for the action.

originsOut should point to a STEAM_CONTROLLER_MAX_ORIGINS sized array of EControllerActionOrigin handles

GetConnectedControllers ( ControllerHandle_t handlesOut ) : int

Enumerate currently connected controllers

handlesOut should point to a STEAM_CONTROLLER_MAX_COUNT sized array of ControllerHandle_t handles

Returns the number of handles written to handlesOut

GetControllerForGamepadIndex ( int nIndex ) : ControllerHandle_t

Returns the associated controller handle for the specified emulated gamepad

GetCurrentActionSet ( ControllerHandle_t controllerHandle ) : ControllerActionSetHandle_t
GetDigitalActionData ( ControllerHandle_t controllerHandle, ControllerDigitalActionHandle_t digitalActionHandle ) : ControllerDigitalActionData_t

Returns the current state of the supplied digital game action

GetDigitalActionHandle ( string pszActionName ) : ControllerDigitalActionHandle_t

ACTIONS

Lookup the handle for a digital action. Best to do this once on startup, and store the handles for all future API calls.

GetDigitalActionOrigins ( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetHandle, ControllerDigitalActionHandle_t digitalActionHandle, EControllerActionOrigin originsOut ) : int

Get the origin(s) for a digital action within an action set. Returns the number of origins supplied in originsOut. Use this to display the appropriate on-screen prompt for the action.

originsOut should point to a STEAM_CONTROLLER_MAX_ORIGINS sized array of EControllerActionOrigin handles

GetGamepadIndexForController ( ControllerHandle_t ulControllerHandle ) : int

Returns the associated gamepad index for the specified controller, if emulating a gamepad

GetGlyphForActionOrigin ( EControllerActionOrigin eOrigin ) : string

Get a local path to art for on-screen glyph for a particular origin

GetMotionData ( ControllerHandle_t controllerHandle ) : ControllerMotionData_t

Returns raw motion data from the specified controller

GetStringForActionOrigin ( EControllerActionOrigin eOrigin ) : string

Returns a localized string (from Steam's language setting) for the specified origin

Init ( ) : bool

Init and Shutdown must be called when starting/ending use of this interface

RunFrame ( ) : void

Synchronize API state with the latest Steam Controller inputs available. This

is performed automatically by SteamAPI_RunCallbacks, but for the absolute lowest

possible latency, you call this directly before reading controller state.

SetLEDColor ( ControllerHandle_t controllerHandle, byte nColorR, byte nColorG, byte nColorB, uint nFlags ) : void

Set the controller LED color on supported controllers.

ShowAnalogActionOrigins ( ControllerHandle_t controllerHandle, ControllerAnalogActionHandle_t analogActionHandle, float flScale, float flXPosition, float flYPosition ) : bool
ShowBindingPanel ( ControllerHandle_t controllerHandle ) : bool

Invokes the Steam overlay and brings up the binding screen

Returns false is overlay is disabled / unavailable, or the user is not in Big Picture mode

ShowDigitalActionOrigins ( ControllerHandle_t controllerHandle, ControllerDigitalActionHandle_t digitalActionHandle, float flScale, float flXPosition, float flYPosition ) : bool

Attempt to display origins of given action in the controller HUD, for the currently active action set

Returns false is overlay is disabled / unavailable, or the user is not in Big Picture mode

Shutdown ( ) : bool
StopAnalogActionMomentum ( ControllerHandle_t controllerHandle, ControllerAnalogActionHandle_t eAction ) : void
TriggerHapticPulse ( ControllerHandle_t controllerHandle, ESteamControllerPad eTargetPad, ushort usDurationMicroSec ) : void

Trigger a haptic pulse on a controller

TriggerRepeatedHapticPulse ( ControllerHandle_t controllerHandle, ESteamControllerPad eTargetPad, ushort usDurationMicroSec, ushort usOffMicroSec, ushort unRepeat, uint nFlags ) : void

Trigger a pulse with a duty cycle of usDurationMicroSec / usOffMicroSec, unRepeat times.

nFlags is currently unused and reserved for future use.

TriggerVibration ( ControllerHandle_t controllerHandle, ushort usLeftSpeed, ushort usRightSpeed ) : void

Tigger a vibration event on supported controllers.

Method Details

ActivateActionSet() public static method

Reconfigure the controller to use the specified action set (ie 'Menu', 'Walk' or 'Drive')

This is cheap, and can be safely called repeatedly. It's often easier to repeatedly call it in

your state loops, instead of trying to place it in all of your state transitions.

public static ActivateActionSet ( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetHandle ) : void
controllerHandle ControllerHandle_t
actionSetHandle ControllerActionSetHandle_t
return void

GetActionSetHandle() public static method

ACTION SETS

Lookup the handle for an Action Set. Best to do this once on startup, and store the handles for all future API calls.

public static GetActionSetHandle ( string pszActionSetName ) : ControllerActionSetHandle_t
pszActionSetName string
return ControllerActionSetHandle_t

GetAnalogActionData() public static method

Returns the current state of these supplied analog game action

public static GetAnalogActionData ( ControllerHandle_t controllerHandle, ControllerAnalogActionHandle_t analogActionHandle ) : ControllerAnalogActionData_t
controllerHandle ControllerHandle_t
analogActionHandle ControllerAnalogActionHandle_t
return ControllerAnalogActionData_t

GetAnalogActionHandle() public static method

Lookup the handle for an analog action. Best to do this once on startup, and store the handles for all future API calls.

public static GetAnalogActionHandle ( string pszActionName ) : ControllerAnalogActionHandle_t
pszActionName string
return ControllerAnalogActionHandle_t

GetAnalogActionOrigins() public static method

Get the origin(s) for an analog action within an action set. Returns the number of origins supplied in originsOut. Use this to display the appropriate on-screen prompt for the action.

originsOut should point to a STEAM_CONTROLLER_MAX_ORIGINS sized array of EControllerActionOrigin handles

public static GetAnalogActionOrigins ( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetHandle, ControllerAnalogActionHandle_t analogActionHandle, EControllerActionOrigin originsOut ) : int
controllerHandle ControllerHandle_t
actionSetHandle ControllerActionSetHandle_t
analogActionHandle ControllerAnalogActionHandle_t
originsOut EControllerActionOrigin
return int

GetConnectedControllers() public static method

Enumerate currently connected controllers

handlesOut should point to a STEAM_CONTROLLER_MAX_COUNT sized array of ControllerHandle_t handles

Returns the number of handles written to handlesOut

public static GetConnectedControllers ( ControllerHandle_t handlesOut ) : int
handlesOut ControllerHandle_t
return int

GetControllerForGamepadIndex() public static method

Returns the associated controller handle for the specified emulated gamepad

public static GetControllerForGamepadIndex ( int nIndex ) : ControllerHandle_t
nIndex int
return ControllerHandle_t

GetCurrentActionSet() public static method

public static GetCurrentActionSet ( ControllerHandle_t controllerHandle ) : ControllerActionSetHandle_t
controllerHandle ControllerHandle_t
return ControllerActionSetHandle_t

GetDigitalActionData() public static method

Returns the current state of the supplied digital game action

public static GetDigitalActionData ( ControllerHandle_t controllerHandle, ControllerDigitalActionHandle_t digitalActionHandle ) : ControllerDigitalActionData_t
controllerHandle ControllerHandle_t
digitalActionHandle ControllerDigitalActionHandle_t
return ControllerDigitalActionData_t

GetDigitalActionHandle() public static method

ACTIONS

Lookup the handle for a digital action. Best to do this once on startup, and store the handles for all future API calls.

public static GetDigitalActionHandle ( string pszActionName ) : ControllerDigitalActionHandle_t
pszActionName string
return ControllerDigitalActionHandle_t

GetDigitalActionOrigins() public static method

Get the origin(s) for a digital action within an action set. Returns the number of origins supplied in originsOut. Use this to display the appropriate on-screen prompt for the action.

originsOut should point to a STEAM_CONTROLLER_MAX_ORIGINS sized array of EControllerActionOrigin handles

public static GetDigitalActionOrigins ( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetHandle, ControllerDigitalActionHandle_t digitalActionHandle, EControllerActionOrigin originsOut ) : int
controllerHandle ControllerHandle_t
actionSetHandle ControllerActionSetHandle_t
digitalActionHandle ControllerDigitalActionHandle_t
originsOut EControllerActionOrigin
return int

GetGamepadIndexForController() public static method

Returns the associated gamepad index for the specified controller, if emulating a gamepad

public static GetGamepadIndexForController ( ControllerHandle_t ulControllerHandle ) : int
ulControllerHandle ControllerHandle_t
return int

GetGlyphForActionOrigin() public static method

Get a local path to art for on-screen glyph for a particular origin

public static GetGlyphForActionOrigin ( EControllerActionOrigin eOrigin ) : string
eOrigin EControllerActionOrigin
return string

GetMotionData() public static method

Returns raw motion data from the specified controller

public static GetMotionData ( ControllerHandle_t controllerHandle ) : ControllerMotionData_t
controllerHandle ControllerHandle_t
return ControllerMotionData_t

GetStringForActionOrigin() public static method

Returns a localized string (from Steam's language setting) for the specified origin

public static GetStringForActionOrigin ( EControllerActionOrigin eOrigin ) : string
eOrigin EControllerActionOrigin
return string

Init() public static method

Init and Shutdown must be called when starting/ending use of this interface

public static Init ( ) : bool
return bool

RunFrame() public static method

Synchronize API state with the latest Steam Controller inputs available. This

is performed automatically by SteamAPI_RunCallbacks, but for the absolute lowest

possible latency, you call this directly before reading controller state.

public static RunFrame ( ) : void
return void

SetLEDColor() public static method

Set the controller LED color on supported controllers.

public static SetLEDColor ( ControllerHandle_t controllerHandle, byte nColorR, byte nColorG, byte nColorB, uint nFlags ) : void
controllerHandle ControllerHandle_t
nColorR byte
nColorG byte
nColorB byte
nFlags uint
return void

ShowAnalogActionOrigins() public static method

public static ShowAnalogActionOrigins ( ControllerHandle_t controllerHandle, ControllerAnalogActionHandle_t analogActionHandle, float flScale, float flXPosition, float flYPosition ) : bool
controllerHandle ControllerHandle_t
analogActionHandle ControllerAnalogActionHandle_t
flScale float
flXPosition float
flYPosition float
return bool

ShowBindingPanel() public static method

Invokes the Steam overlay and brings up the binding screen

Returns false is overlay is disabled / unavailable, or the user is not in Big Picture mode

public static ShowBindingPanel ( ControllerHandle_t controllerHandle ) : bool
controllerHandle ControllerHandle_t
return bool

ShowDigitalActionOrigins() public static method

Attempt to display origins of given action in the controller HUD, for the currently active action set

Returns false is overlay is disabled / unavailable, or the user is not in Big Picture mode

public static ShowDigitalActionOrigins ( ControllerHandle_t controllerHandle, ControllerDigitalActionHandle_t digitalActionHandle, float flScale, float flXPosition, float flYPosition ) : bool
controllerHandle ControllerHandle_t
digitalActionHandle ControllerDigitalActionHandle_t
flScale float
flXPosition float
flYPosition float
return bool

Shutdown() public static method

public static Shutdown ( ) : bool
return bool

StopAnalogActionMomentum() public static method

public static StopAnalogActionMomentum ( ControllerHandle_t controllerHandle, ControllerAnalogActionHandle_t eAction ) : void
controllerHandle ControllerHandle_t
eAction ControllerAnalogActionHandle_t
return void

TriggerHapticPulse() public static method

Trigger a haptic pulse on a controller

public static TriggerHapticPulse ( ControllerHandle_t controllerHandle, ESteamControllerPad eTargetPad, ushort usDurationMicroSec ) : void
controllerHandle ControllerHandle_t
eTargetPad ESteamControllerPad
usDurationMicroSec ushort
return void

TriggerRepeatedHapticPulse() public static method

Trigger a pulse with a duty cycle of usDurationMicroSec / usOffMicroSec, unRepeat times.

nFlags is currently unused and reserved for future use.

public static TriggerRepeatedHapticPulse ( ControllerHandle_t controllerHandle, ESteamControllerPad eTargetPad, ushort usDurationMicroSec, ushort usOffMicroSec, ushort unRepeat, uint nFlags ) : void
controllerHandle ControllerHandle_t
eTargetPad ESteamControllerPad
usDurationMicroSec ushort
usOffMicroSec ushort
unRepeat ushort
nFlags uint
return void

TriggerVibration() public static method

Tigger a vibration event on supported controllers.

public static TriggerVibration ( ControllerHandle_t controllerHandle, ushort usLeftSpeed, ushort usRightSpeed ) : void
controllerHandle ControllerHandle_t
usLeftSpeed ushort
usRightSpeed ushort
return void