steamcontroller

package
v0.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package steamcontroller wraps Steam's controller input API.

This package is only available on clients.

Unlike the C++ Steam API, this package automatically calls Init and Shutdown as needed.

See the Steam Input documentation for more details. <https://partner.steamgames.com/doc/features/steam_controller>

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActivateActionSet

func ActivateActionSet(controller Handle, actionSet ActionSetHandle)

ActivateActionSet reconfigures 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.

Example:

func updateStateLoop(current steamcontroller.Handle) {
    switch currentState {
    case MENU:
        steamcontroller.ActivateActionSet(current, menuSetHandle)
        doMenuStuff()
    case WALKING:
        steamcontroller.ActivateActionSet(current, walkingSetHandle)
        doWalkingStuff()
    case DRIVING:
        steamcontroller.ActivateActionSet(current, drivingSetHandle)
        doDrivingStuff()
    case FIGHTING:
        steamcontroller.ActivateActionSet(current, fightingSetHandle)
        doFightingStuff()
    }
}

func GetDigitalActionData

func GetDigitalActionData(controller Handle, digitalAction DigitalActionHandle) (state, active bool)

GetDigitalActionData returns the current state of the specified digital game action.

func GetGamepadIndexForController

func GetGamepadIndexForController(controller Handle) int

GetGamepadIndexForController returns the associated gamepad index for the specified controller, if emulating a gamepad.

func GetGlyphForActionOrigin

func GetGlyphForActionOrigin(origin ActionOrigin) string

GetGlyphForActionOrigin returns a local path to art for on-screen glyph for a particular origin. The returned path refers to a PNG file.

func GetStringForActionOrigin

func GetStringForActionOrigin(origin ActionOrigin) string

GetStringForActionOrigin returns a localized string (from Steam's language setting) for the specified origin.

func ResetLEDColor

func ResetLEDColor(controller Handle)

ResetLEDColor restores the out-of-game default color for the specified controller.

func RunFrame

func RunFrame()

RunFrame synchronizes API state with the latest Steam Controller inputs available. This is performed automatically by steamworks.RunCallbacks, but for the absolute lowest possible latency, you can call this directly before reading controller state.

func SetLEDColor

func SetLEDColor(controller Handle, r, g, b uint8)

SetLEDColor sets the controller LED color on supported controllers.

NOTE: The VSC does not support any color but white, and will interpret the RGB values as a greyscale value affecting the brightness of the Steam button LED. The DS4 responds to full color information and uses the values to set the color and brightness of the lightbar.

func ShowBindingPanel

func ShowBindingPanel(controller Handle) bool

ShowBindingPanel invokes the Steam overlay and brings up the binding screen.

Returns true for success; false if the overlay is disabled or unavailable, or if the user is not in Big Picture mode.

func StopAnalogActionMomentum

func StopAnalogActionMomentum(controller Handle, analogAction AnalogActionHandle)

StopAnalogActionMomentum stops the momentum of an analog action (where applicable, e.g. a touchpad with virtual trackball settings).

NOTE: This will also stop all associated haptics. This is useful for situations where you want to indicate to the user that the limit of an action has been reached, such as spinning a carousel or scrolling a webpage.

func TriggerHapticPulse

func TriggerHapticPulse(controller Handle, targetPad Pad, duration time.Duration)

Triggers a (low-level) haptic pulse on supported controllers.

NOTE: Currently only the VSC supports haptic pulses. This API call will be ignored for all other controller models.

The longest haptic pulse you can trigger with this method has a duration of 0.065535 seconds (i.e., less than 1/10th of a second). This function should be thought of as a low-level primitive meant to be repeatedly used in higher-level user functions to generate more sophisticated behavior.

func TriggerRepeatedHapticPulse

func TriggerRepeatedHapticPulse(controller Handle, targetPad Pad, duration, off time.Duration, repeats uint16)

TriggerRepeatedHapticPulse triggers a repeated haptic pulse on supported controllers.

NOTE: Currently only the VSC supports haptic pulses. This API call will be ignored for incompatible controller models.

This is a more user-friendly function to call than TriggerHapticPulse as it can generate pulse patterns long enough to be actually noticed by the user.

Changing the duration and off parameters will change the "texture" of the haptic pulse. The maximum value for either parameter is 0.065535 seconds.

func TriggerVibration

func TriggerVibration(controller Handle, leftSpeed, rightSpeed time.Duration)

TriggerVibration triggers a vibration event on supported controllers.

NOTE: This API call will be ignored for incompatible controller models. This generates the traditional "rumble" vibration effect. The VSC will emulate traditional rumble using its haptics.

leftSpeed and rightSpeed are the period of the corresponding rumble motor's vibration. The maximum value for either parameter is 0.065535 seconds.

Types

type ActionOrigin

type ActionOrigin = internal.EControllerActionOrigin

ActionOrigin represents an input the player binds to an action in the Steam Controller Configurator. The chief purpose of these values is to direct which on-screen button glyphs should appear for a given action, such as "Press [A] to Jump".

const (
	AONone                             ActionOrigin = internal.EControllerActionOrigin_None
	AOA                                ActionOrigin = internal.EControllerActionOrigin_A
	AOB                                ActionOrigin = internal.EControllerActionOrigin_B
	AOX                                ActionOrigin = internal.EControllerActionOrigin_X
	AOY                                ActionOrigin = internal.EControllerActionOrigin_Y
	AOLeftBumper                       ActionOrigin = internal.EControllerActionOrigin_LeftBumper
	AORightBumper                      ActionOrigin = internal.EControllerActionOrigin_RightBumper
	AOLeftGrip                         ActionOrigin = internal.EControllerActionOrigin_LeftGrip
	AORightGrip                        ActionOrigin = internal.EControllerActionOrigin_RightGrip
	AOStart                            ActionOrigin = internal.EControllerActionOrigin_Start
	AOBack                             ActionOrigin = internal.EControllerActionOrigin_Back
	AOLeftPad_Touch                    ActionOrigin = internal.EControllerActionOrigin_LeftPad_Touch
	AOLeftPad_Swipe                    ActionOrigin = internal.EControllerActionOrigin_LeftPad_Swipe
	AOLeftPad_Click                    ActionOrigin = internal.EControllerActionOrigin_LeftPad_Click
	AOLeftPad_DPadNorth                ActionOrigin = internal.EControllerActionOrigin_LeftPad_DPadNorth
	AOLeftPad_DPadSouth                ActionOrigin = internal.EControllerActionOrigin_LeftPad_DPadSouth
	AOLeftPad_DPadWest                 ActionOrigin = internal.EControllerActionOrigin_LeftPad_DPadWest
	AOLeftPad_DPadEast                 ActionOrigin = internal.EControllerActionOrigin_LeftPad_DPadEast
	AORightPad_Touch                   ActionOrigin = internal.EControllerActionOrigin_RightPad_Touch
	AORightPad_Swipe                   ActionOrigin = internal.EControllerActionOrigin_RightPad_Swipe
	AORightPad_Click                   ActionOrigin = internal.EControllerActionOrigin_RightPad_Click
	AORightPad_DPadNorth               ActionOrigin = internal.EControllerActionOrigin_RightPad_DPadNorth
	AORightPad_DPadSouth               ActionOrigin = internal.EControllerActionOrigin_RightPad_DPadSouth
	AORightPad_DPadWest                ActionOrigin = internal.EControllerActionOrigin_RightPad_DPadWest
	AORightPad_DPadEast                ActionOrigin = internal.EControllerActionOrigin_RightPad_DPadEast
	AOLeftTrigger_Pull                 ActionOrigin = internal.EControllerActionOrigin_LeftTrigger_Pull
	AOLeftTrigger_Click                ActionOrigin = internal.EControllerActionOrigin_LeftTrigger_Click
	AORightTrigger_Pull                ActionOrigin = internal.EControllerActionOrigin_RightTrigger_Pull
	AORightTrigger_Click               ActionOrigin = internal.EControllerActionOrigin_RightTrigger_Click
	AOLeftStick_Move                   ActionOrigin = internal.EControllerActionOrigin_LeftStick_Move
	AOLeftStick_Click                  ActionOrigin = internal.EControllerActionOrigin_LeftStick_Click
	AOLeftStick_DPadNorth              ActionOrigin = internal.EControllerActionOrigin_LeftStick_DPadNorth
	AOLeftStick_DPadSouth              ActionOrigin = internal.EControllerActionOrigin_LeftStick_DPadSouth
	AOLeftStick_DPadWest               ActionOrigin = internal.EControllerActionOrigin_LeftStick_DPadWest
	AOLeftStick_DPadEast               ActionOrigin = internal.EControllerActionOrigin_LeftStick_DPadEast
	AOGyro_Move                        ActionOrigin = internal.EControllerActionOrigin_Gyro_Move
	AOGyro_Pitch                       ActionOrigin = internal.EControllerActionOrigin_Gyro_Pitch
	AOGyro_Yaw                         ActionOrigin = internal.EControllerActionOrigin_Gyro_Yaw
	AOGyro_Roll                        ActionOrigin = internal.EControllerActionOrigin_Gyro_Roll
	AOPS4_X                            ActionOrigin = internal.EControllerActionOrigin_PS4_X
	AOPS4_Circle                       ActionOrigin = internal.EControllerActionOrigin_PS4_Circle
	AOPS4_Triangle                     ActionOrigin = internal.EControllerActionOrigin_PS4_Triangle
	AOPS4_Square                       ActionOrigin = internal.EControllerActionOrigin_PS4_Square
	AOPS4_LeftBumper                   ActionOrigin = internal.EControllerActionOrigin_PS4_LeftBumper
	AOPS4_RightBumper                  ActionOrigin = internal.EControllerActionOrigin_PS4_RightBumper
	AOPS4_Options                      ActionOrigin = internal.EControllerActionOrigin_PS4_Options
	AOPS4_Share                        ActionOrigin = internal.EControllerActionOrigin_PS4_Share
	AOPS4_LeftPad_Touch                ActionOrigin = internal.EControllerActionOrigin_PS4_LeftPad_Touch
	AOPS4_LeftPad_Swipe                ActionOrigin = internal.EControllerActionOrigin_PS4_LeftPad_Swipe
	AOPS4_LeftPad_Click                ActionOrigin = internal.EControllerActionOrigin_PS4_LeftPad_Click
	AOPS4_LeftPad_DPadNorth            ActionOrigin = internal.EControllerActionOrigin_PS4_LeftPad_DPadNorth
	AOPS4_LeftPad_DPadSouth            ActionOrigin = internal.EControllerActionOrigin_PS4_LeftPad_DPadSouth
	AOPS4_LeftPad_DPadWest             ActionOrigin = internal.EControllerActionOrigin_PS4_LeftPad_DPadWest
	AOPS4_LeftPad_DPadEast             ActionOrigin = internal.EControllerActionOrigin_PS4_LeftPad_DPadEast
	AOPS4_RightPad_Touch               ActionOrigin = internal.EControllerActionOrigin_PS4_RightPad_Touch
	AOPS4_RightPad_Swipe               ActionOrigin = internal.EControllerActionOrigin_PS4_RightPad_Swipe
	AOPS4_RightPad_Click               ActionOrigin = internal.EControllerActionOrigin_PS4_RightPad_Click
	AOPS4_RightPad_DPadNorth           ActionOrigin = internal.EControllerActionOrigin_PS4_RightPad_DPadNorth
	AOPS4_RightPad_DPadSouth           ActionOrigin = internal.EControllerActionOrigin_PS4_RightPad_DPadSouth
	AOPS4_RightPad_DPadWest            ActionOrigin = internal.EControllerActionOrigin_PS4_RightPad_DPadWest
	AOPS4_RightPad_DPadEast            ActionOrigin = internal.EControllerActionOrigin_PS4_RightPad_DPadEast
	AOPS4_CenterPad_Touch              ActionOrigin = internal.EControllerActionOrigin_PS4_CenterPad_Touch
	AOPS4_CenterPad_Swipe              ActionOrigin = internal.EControllerActionOrigin_PS4_CenterPad_Swipe
	AOPS4_CenterPad_Click              ActionOrigin = internal.EControllerActionOrigin_PS4_CenterPad_Click
	AOPS4_CenterPad_DPadNorth          ActionOrigin = internal.EControllerActionOrigin_PS4_CenterPad_DPadNorth
	AOPS4_CenterPad_DPadSouth          ActionOrigin = internal.EControllerActionOrigin_PS4_CenterPad_DPadSouth
	AOPS4_CenterPad_DPadWest           ActionOrigin = internal.EControllerActionOrigin_PS4_CenterPad_DPadWest
	AOPS4_CenterPad_DPadEast           ActionOrigin = internal.EControllerActionOrigin_PS4_CenterPad_DPadEast
	AOPS4_LeftTrigger_Pull             ActionOrigin = internal.EControllerActionOrigin_PS4_LeftTrigger_Pull
	AOPS4_LeftTrigger_Click            ActionOrigin = internal.EControllerActionOrigin_PS4_LeftTrigger_Click
	AOPS4_RightTrigger_Pull            ActionOrigin = internal.EControllerActionOrigin_PS4_RightTrigger_Pull
	AOPS4_RightTrigger_Click           ActionOrigin = internal.EControllerActionOrigin_PS4_RightTrigger_Click
	AOPS4_LeftStick_Move               ActionOrigin = internal.EControllerActionOrigin_PS4_LeftStick_Move
	AOPS4_LeftStick_Click              ActionOrigin = internal.EControllerActionOrigin_PS4_LeftStick_Click
	AOPS4_LeftStick_DPadNorth          ActionOrigin = internal.EControllerActionOrigin_PS4_LeftStick_DPadNorth
	AOPS4_LeftStick_DPadSouth          ActionOrigin = internal.EControllerActionOrigin_PS4_LeftStick_DPadSouth
	AOPS4_LeftStick_DPadWest           ActionOrigin = internal.EControllerActionOrigin_PS4_LeftStick_DPadWest
	AOPS4_LeftStick_DPadEast           ActionOrigin = internal.EControllerActionOrigin_PS4_LeftStick_DPadEast
	AOPS4_RightStick_Move              ActionOrigin = internal.EControllerActionOrigin_PS4_RightStick_Move
	AOPS4_RightStick_Click             ActionOrigin = internal.EControllerActionOrigin_PS4_RightStick_Click
	AOPS4_RightStick_DPadNorth         ActionOrigin = internal.EControllerActionOrigin_PS4_RightStick_DPadNorth
	AOPS4_RightStick_DPadSouth         ActionOrigin = internal.EControllerActionOrigin_PS4_RightStick_DPadSouth
	AOPS4_RightStick_DPadWest          ActionOrigin = internal.EControllerActionOrigin_PS4_RightStick_DPadWest
	AOPS4_RightStick_DPadEast          ActionOrigin = internal.EControllerActionOrigin_PS4_RightStick_DPadEast
	AOPS4_DPad_North                   ActionOrigin = internal.EControllerActionOrigin_PS4_DPad_North
	AOPS4_DPad_South                   ActionOrigin = internal.EControllerActionOrigin_PS4_DPad_South
	AOPS4_DPad_West                    ActionOrigin = internal.EControllerActionOrigin_PS4_DPad_West
	AOPS4_DPad_East                    ActionOrigin = internal.EControllerActionOrigin_PS4_DPad_East
	AOPS4_Gyro_Move                    ActionOrigin = internal.EControllerActionOrigin_PS4_Gyro_Move
	AOPS4_Gyro_Pitch                   ActionOrigin = internal.EControllerActionOrigin_PS4_Gyro_Pitch
	AOPS4_Gyro_Yaw                     ActionOrigin = internal.EControllerActionOrigin_PS4_Gyro_Yaw
	AOPS4_Gyro_Roll                    ActionOrigin = internal.EControllerActionOrigin_PS4_Gyro_Roll
	AOXBoxOne_A                        ActionOrigin = internal.EControllerActionOrigin_XBoxOne_A
	AOXBoxOne_B                        ActionOrigin = internal.EControllerActionOrigin_XBoxOne_B
	AOXBoxOne_X                        ActionOrigin = internal.EControllerActionOrigin_XBoxOne_X
	AOXBoxOne_Y                        ActionOrigin = internal.EControllerActionOrigin_XBoxOne_Y
	AOXBoxOne_LeftBumper               ActionOrigin = internal.EControllerActionOrigin_XBoxOne_LeftBumper
	AOXBoxOne_RightBumper              ActionOrigin = internal.EControllerActionOrigin_XBoxOne_RightBumper
	AOXBoxOne_Menu                     ActionOrigin = internal.EControllerActionOrigin_XBoxOne_Menu
	AOXBoxOne_View                     ActionOrigin = internal.EControllerActionOrigin_XBoxOne_View
	AOXBoxOne_LeftTrigger_Pull         ActionOrigin = internal.EControllerActionOrigin_XBoxOne_LeftTrigger_Pull
	AOXBoxOne_LeftTrigger_Click        ActionOrigin = internal.EControllerActionOrigin_XBoxOne_LeftTrigger_Click
	AOXBoxOne_RightTrigger_Pull        ActionOrigin = internal.EControllerActionOrigin_XBoxOne_RightTrigger_Pull
	AOXBoxOne_RightTrigger_Click       ActionOrigin = internal.EControllerActionOrigin_XBoxOne_RightTrigger_Click
	AOXBoxOne_LeftStick_Move           ActionOrigin = internal.EControllerActionOrigin_XBoxOne_LeftStick_Move
	AOXBoxOne_LeftStick_Click          ActionOrigin = internal.EControllerActionOrigin_XBoxOne_LeftStick_Click
	AOXBoxOne_LeftStick_DPadNorth      ActionOrigin = internal.EControllerActionOrigin_XBoxOne_LeftStick_DPadNorth
	AOXBoxOne_LeftStick_DPadSouth      ActionOrigin = internal.EControllerActionOrigin_XBoxOne_LeftStick_DPadSouth
	AOXBoxOne_LeftStick_DPadWest       ActionOrigin = internal.EControllerActionOrigin_XBoxOne_LeftStick_DPadWest
	AOXBoxOne_LeftStick_DPadEast       ActionOrigin = internal.EControllerActionOrigin_XBoxOne_LeftStick_DPadEast
	AOXBoxOne_RightStick_Move          ActionOrigin = internal.EControllerActionOrigin_XBoxOne_RightStick_Move
	AOXBoxOne_RightStick_Click         ActionOrigin = internal.EControllerActionOrigin_XBoxOne_RightStick_Click
	AOXBoxOne_RightStick_DPadNorth     ActionOrigin = internal.EControllerActionOrigin_XBoxOne_RightStick_DPadNorth
	AOXBoxOne_RightStick_DPadSouth     ActionOrigin = internal.EControllerActionOrigin_XBoxOne_RightStick_DPadSouth
	AOXBoxOne_RightStick_DPadWest      ActionOrigin = internal.EControllerActionOrigin_XBoxOne_RightStick_DPadWest
	AOXBoxOne_RightStick_DPadEast      ActionOrigin = internal.EControllerActionOrigin_XBoxOne_RightStick_DPadEast
	AOXBoxOne_DPad_North               ActionOrigin = internal.EControllerActionOrigin_XBoxOne_DPad_North
	AOXBoxOne_DPad_South               ActionOrigin = internal.EControllerActionOrigin_XBoxOne_DPad_South
	AOXBoxOne_DPad_West                ActionOrigin = internal.EControllerActionOrigin_XBoxOne_DPad_West
	AOXBoxOne_DPad_East                ActionOrigin = internal.EControllerActionOrigin_XBoxOne_DPad_East
	AOXBox360_A                        ActionOrigin = internal.EControllerActionOrigin_XBox360_A
	AOXBox360_B                        ActionOrigin = internal.EControllerActionOrigin_XBox360_B
	AOXBox360_X                        ActionOrigin = internal.EControllerActionOrigin_XBox360_X
	AOXBox360_Y                        ActionOrigin = internal.EControllerActionOrigin_XBox360_Y
	AOXBox360_LeftBumper               ActionOrigin = internal.EControllerActionOrigin_XBox360_LeftBumper
	AOXBox360_RightBumper              ActionOrigin = internal.EControllerActionOrigin_XBox360_RightBumper
	AOXBox360_Start                    ActionOrigin = internal.EControllerActionOrigin_XBox360_Start
	AOXBox360_Back                     ActionOrigin = internal.EControllerActionOrigin_XBox360_Back
	AOXBox360_LeftTrigger_Pull         ActionOrigin = internal.EControllerActionOrigin_XBox360_LeftTrigger_Pull
	AOXBox360_LeftTrigger_Click        ActionOrigin = internal.EControllerActionOrigin_XBox360_LeftTrigger_Click
	AOXBox360_RightTrigger_Pull        ActionOrigin = internal.EControllerActionOrigin_XBox360_RightTrigger_Pull
	AOXBox360_RightTrigger_Click       ActionOrigin = internal.EControllerActionOrigin_XBox360_RightTrigger_Click
	AOXBox360_LeftStick_Move           ActionOrigin = internal.EControllerActionOrigin_XBox360_LeftStick_Move
	AOXBox360_LeftStick_Click          ActionOrigin = internal.EControllerActionOrigin_XBox360_LeftStick_Click
	AOXBox360_LeftStick_DPadNorth      ActionOrigin = internal.EControllerActionOrigin_XBox360_LeftStick_DPadNorth
	AOXBox360_LeftStick_DPadSouth      ActionOrigin = internal.EControllerActionOrigin_XBox360_LeftStick_DPadSouth
	AOXBox360_LeftStick_DPadWest       ActionOrigin = internal.EControllerActionOrigin_XBox360_LeftStick_DPadWest
	AOXBox360_LeftStick_DPadEast       ActionOrigin = internal.EControllerActionOrigin_XBox360_LeftStick_DPadEast
	AOXBox360_RightStick_Move          ActionOrigin = internal.EControllerActionOrigin_XBox360_RightStick_Move
	AOXBox360_RightStick_Click         ActionOrigin = internal.EControllerActionOrigin_XBox360_RightStick_Click
	AOXBox360_RightStick_DPadNorth     ActionOrigin = internal.EControllerActionOrigin_XBox360_RightStick_DPadNorth
	AOXBox360_RightStick_DPadSouth     ActionOrigin = internal.EControllerActionOrigin_XBox360_RightStick_DPadSouth
	AOXBox360_RightStick_DPadWest      ActionOrigin = internal.EControllerActionOrigin_XBox360_RightStick_DPadWest
	AOXBox360_RightStick_DPadEast      ActionOrigin = internal.EControllerActionOrigin_XBox360_RightStick_DPadEast
	AOXBox360_DPad_North               ActionOrigin = internal.EControllerActionOrigin_XBox360_DPad_North
	AOXBox360_DPad_South               ActionOrigin = internal.EControllerActionOrigin_XBox360_DPad_South
	AOXBox360_DPad_West                ActionOrigin = internal.EControllerActionOrigin_XBox360_DPad_West
	AOXBox360_DPad_East                ActionOrigin = internal.EControllerActionOrigin_XBox360_DPad_East
	AOSteamV2_A                        ActionOrigin = internal.EControllerActionOrigin_SteamV2_A
	AOSteamV2_B                        ActionOrigin = internal.EControllerActionOrigin_SteamV2_B
	AOSteamV2_X                        ActionOrigin = internal.EControllerActionOrigin_SteamV2_X
	AOSteamV2_Y                        ActionOrigin = internal.EControllerActionOrigin_SteamV2_Y
	AOSteamV2_LeftBumper               ActionOrigin = internal.EControllerActionOrigin_SteamV2_LeftBumper
	AOSteamV2_RightBumper              ActionOrigin = internal.EControllerActionOrigin_SteamV2_RightBumper
	AOSteamV2_LeftGrip                 ActionOrigin = internal.EControllerActionOrigin_SteamV2_LeftGrip
	AOSteamV2_RightGrip                ActionOrigin = internal.EControllerActionOrigin_SteamV2_RightGrip
	AOSteamV2_LeftGrip_Upper           ActionOrigin = internal.EControllerActionOrigin_SteamV2_LeftGrip_Upper
	AOSteamV2_RightGrip_Upper          ActionOrigin = internal.EControllerActionOrigin_SteamV2_RightGrip_Upper
	AOSteamV2_LeftBumper_Pressure      ActionOrigin = internal.EControllerActionOrigin_SteamV2_LeftBumper_Pressure
	AOSteamV2_RightBumper_Pressure     ActionOrigin = internal.EControllerActionOrigin_SteamV2_RightBumper_Pressure
	AOSteamV2_LeftGrip_Pressure        ActionOrigin = internal.EControllerActionOrigin_SteamV2_LeftGrip_Pressure
	AOSteamV2_RightGrip_Pressure       ActionOrigin = internal.EControllerActionOrigin_SteamV2_RightGrip_Pressure
	AOSteamV2_LeftGrip_Upper_Pressure  ActionOrigin = internal.EControllerActionOrigin_SteamV2_LeftGrip_Upper_Pressure
	AOSteamV2_RightGrip_Upper_Pressure ActionOrigin = internal.EControllerActionOrigin_SteamV2_RightGrip_Upper_Pressure
	AOSteamV2_Start                    ActionOrigin = internal.EControllerActionOrigin_SteamV2_Start
	AOSteamV2_Back                     ActionOrigin = internal.EControllerActionOrigin_SteamV2_Back
	AOSteamV2_LeftPad_Touch            ActionOrigin = internal.EControllerActionOrigin_SteamV2_LeftPad_Touch
	AOSteamV2_LeftPad_Swipe            ActionOrigin = internal.EControllerActionOrigin_SteamV2_LeftPad_Swipe
	AOSteamV2_LeftPad_Click            ActionOrigin = internal.EControllerActionOrigin_SteamV2_LeftPad_Click
	AOSteamV2_LeftPad_Pressure         ActionOrigin = internal.EControllerActionOrigin_SteamV2_LeftPad_Pressure
	AOSteamV2_LeftPad_DPadNorth        ActionOrigin = internal.EControllerActionOrigin_SteamV2_LeftPad_DPadNorth
	AOSteamV2_LeftPad_DPadSouth        ActionOrigin = internal.EControllerActionOrigin_SteamV2_LeftPad_DPadSouth
	AOSteamV2_LeftPad_DPadWest         ActionOrigin = internal.EControllerActionOrigin_SteamV2_LeftPad_DPadWest
	AOSteamV2_LeftPad_DPadEast         ActionOrigin = internal.EControllerActionOrigin_SteamV2_LeftPad_DPadEast
	AOSteamV2_RightPad_Touch           ActionOrigin = internal.EControllerActionOrigin_SteamV2_RightPad_Touch
	AOSteamV2_RightPad_Swipe           ActionOrigin = internal.EControllerActionOrigin_SteamV2_RightPad_Swipe
	AOSteamV2_RightPad_Click           ActionOrigin = internal.EControllerActionOrigin_SteamV2_RightPad_Click
	AOSteamV2_RightPad_Pressure        ActionOrigin = internal.EControllerActionOrigin_SteamV2_RightPad_Pressure
	AOSteamV2_RightPad_DPadNorth       ActionOrigin = internal.EControllerActionOrigin_SteamV2_RightPad_DPadNorth
	AOSteamV2_RightPad_DPadSouth       ActionOrigin = internal.EControllerActionOrigin_SteamV2_RightPad_DPadSouth
	AOSteamV2_RightPad_DPadWest        ActionOrigin = internal.EControllerActionOrigin_SteamV2_RightPad_DPadWest
	AOSteamV2_RightPad_DPadEast        ActionOrigin = internal.EControllerActionOrigin_SteamV2_RightPad_DPadEast
	AOSteamV2_LeftTrigger_Pull         ActionOrigin = internal.EControllerActionOrigin_SteamV2_LeftTrigger_Pull
	AOSteamV2_LeftTrigger_Click        ActionOrigin = internal.EControllerActionOrigin_SteamV2_LeftTrigger_Click
	AOSteamV2_RightTrigger_Pull        ActionOrigin = internal.EControllerActionOrigin_SteamV2_RightTrigger_Pull
	AOSteamV2_RightTrigger_Click       ActionOrigin = internal.EControllerActionOrigin_SteamV2_RightTrigger_Click
	AOSteamV2_LeftStick_Move           ActionOrigin = internal.EControllerActionOrigin_SteamV2_LeftStick_Move
	AOSteamV2_LeftStick_Click          ActionOrigin = internal.EControllerActionOrigin_SteamV2_LeftStick_Click
	AOSteamV2_LeftStick_DPadNorth      ActionOrigin = internal.EControllerActionOrigin_SteamV2_LeftStick_DPadNorth
	AOSteamV2_LeftStick_DPadSouth      ActionOrigin = internal.EControllerActionOrigin_SteamV2_LeftStick_DPadSouth
	AOSteamV2_LeftStick_DPadWest       ActionOrigin = internal.EControllerActionOrigin_SteamV2_LeftStick_DPadWest
	AOSteamV2_LeftStick_DPadEast       ActionOrigin = internal.EControllerActionOrigin_SteamV2_LeftStick_DPadEast
	AOSteamV2_Gyro_Move                ActionOrigin = internal.EControllerActionOrigin_SteamV2_Gyro_Move
	AOSteamV2_Gyro_Pitch               ActionOrigin = internal.EControllerActionOrigin_SteamV2_Gyro_Pitch
	AOSteamV2_Gyro_Yaw                 ActionOrigin = internal.EControllerActionOrigin_SteamV2_Gyro_Yaw
	AOSteamV2_Gyro_Roll                ActionOrigin = internal.EControllerActionOrigin_SteamV2_Gyro_Roll
	AOCount                            ActionOrigin = internal.EControllerActionOrigin_Count
)

ActionOrigin enum values.

func GetAnalogActionOrigins

func GetAnalogActionOrigins(controller Handle, actionSet ActionSetHandle, analogAction AnalogActionHandle) []ActionOrigin

GetAnalogActionOrigins returns a slice containing the origin(s) for an analog action within an action set. Use this to display the appropriate on-screen prompt for the action.

func GetDigitalActionOrigins

func GetDigitalActionOrigins(controller Handle, actionSet ActionSetHandle, digitalAction DigitalActionHandle) []ActionOrigin

GetDigitalActionOrigins returns a slice containing the origin(s) for a digital action within an action set. Use this to display the appropriate on-screen prompt for the action.

type ActionSetHandle

type ActionSetHandle = internal.ControllerActionSetHandle

ActionSetHandle is used to refer to specific in-game actions or action sets.

func GetActionSetHandle

func GetActionSetHandle(name string) ActionSetHandle

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

The name refers to an identifier in the game's VDF file.

func GetCurrentActionSet

func GetCurrentActionSet(controller Handle) ActionSetHandle

GetCurrentActionSet returns the current action set for the specified controller.

type AnalogActionHandle

type AnalogActionHandle = internal.ControllerAnalogActionHandle

AnalogActionHandle is a handle to an analog action. This can be obtained from GetAnalogActionHandle.

func GetAnalogActionHandle

func GetAnalogActionHandle(name string) AnalogActionHandle

GetAnalogActionHandle gets the handle of the specified analog action.

NOTE: This function does not take an action set handle parameter. That means that each action in your VDF file must have a unique string identifier. In other words, if you use an action called "up" in two different action sets, this function will only ever return one of them and the other will be ignored.

The name refers to an identifier in the game's VDF file.

type ControllerMotionData

type ControllerMotionData struct {
	// RotQuat is the sensor-fused absolute rotation.
	//
	// NOTE: The inertial measurement unit on the controller will create a
	// quaternion based on fusing the gyro and the accelerometer. This value is
	// the absolute orientation of the controller, but it will drift on the yaw
	// axis.
	RotQuat [4]float32

	// PosAccel is the positional acceleration.
	PosAccel [3]float32

	// RotVel is the angular velocity
	RotVel [3]float32
}

ControllerMotionData represents the current state of a device's motion sensor(s).

func GetMotionData

func GetMotionData(controller Handle) ControllerMotionData

GetMotionData returns raw motion data for the specified controller.

type DigitalActionHandle

type DigitalActionHandle = internal.ControllerDigitalActionHandle

DigitalActionHandle is a handle to a digital action. This can be obtained from GetDigitalActionHandle.

func GetDigitalActionHandle

func GetDigitalActionHandle(name string) DigitalActionHandle

GetDigitalActionHandle gets the handle of the specified digital action.

NOTE: This function does not take an action set handle parameter. That means that each action in your VDF file must have a unique string identifier. In other words, if you use an action called "up" in two different action sets, this function will only ever return one of them and the other will be ignored.

The name refers to an identifier in the game's VDF file.

type Handle

type Handle = internal.ControllerHandle

Handle consistently identifies a controller, even if it is disconnected and re-connected.

const AllControllers Handle = Handle(^uint64(0))

AllControllers is a special value that can be used in place of a specific controller handle to send the option to all controllers instead.

func GetConnectedControllers

func GetConnectedControllers() []Handle

GetConnectedControllers enumerates currently connected controllers.

func GetControllerForGamepadIndex

func GetControllerForGamepadIndex(index int) Handle

GetControllerForGamepadIndex returns the associated controller handle for the specified emulated gamepad.

type Pad

Pad is a touchpad region on a Steam Controller Device.

On the VSC, the values correspond to the left & right haptic touchpads.

On the DS4, the values correspond to the left & right halves of the single, central touchpad.

Pad enum values.

type SourceMode

type SourceMode = internal.EControllerSourceMode

SourceMode is the virtual input mode imposed by the configurator upon a controller source. For instance, the configurator can make an analog joystick behave like a Dpad with four digital inputs; the Source would be SourceJoystick and the SourceMode would be SourceModeDpad. The mode also changes the input data received by any associated actions.

func GetAnalogActionData

func GetAnalogActionData(controller Handle, analogAction AnalogActionHandle) (x, y float32, mode SourceMode, active bool)

GetAnalogActionData returns the current state of the specified analog game action for the specified controller.

NOTE: The exact values, range, etc, depend on the configuration, but (broadly speaking) traditional analog actions will provide normalized float values in the ballpark of -1.0 to 1.0, whereas mouse-like actions will provide delta updates which indicate the number of "pixels" moved since the last frame. The upshot of this is that mouse-like actions will provide much larger absolute x and y values, and are relative to the last recorded input position, whereas traditional analog actions are smaller and relative to a central physical anchor point.

While the delta provided by mouse-like actions is very similar to pixel deltas as provided by an OS, the SC deltas are floats, not ints. This means less potential quantization and loss of precision when mapping this data to a camera rotation.

In the case of single-axis analog inputs (such as analog triggers), only the x axis will contain data; the y axis will always be zero.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL