Documentation ¶
Index ¶
- Constants
- func HasStandardAxis(id string, axis StandardAxis) bool
- func HasStandardButton(id string, button StandardButton) bool
- func HasStandardLayoutMapping(id string) bool
- func IsStandardButtonPressed(id string, button StandardButton, state GamepadState) bool
- func Name(id string) string
- func StandardAxisValue(id string, axis StandardAxis, state GamepadState) float64
- func StandardButtonValue(id string, button StandardButton, state GamepadState) float64
- func Update(mappingData []byte) error
- type GamepadState
- type StandardAxis
- type StandardButton
Constants ¶
View Source
const ( HatUp = 1 HatRight = 2 HatDown = 4 HatLeft = 8 )
View Source
const ( SDLControllerButtonA = 0 SDLControllerButtonB = 1 SDLControllerButtonX = 2 SDLControllerButtonY = 3 SDLControllerButtonBack = 4 SDLControllerButtonGuide = 5 SDLControllerButtonStart = 6 SDLControllerButtonLeftStick = 7 SDLControllerButtonRightStick = 8 SDLControllerButtonLeftShoulder = 9 SDLControllerButtonRightShoulder = 10 SDLControllerButtonDpadUp = 11 SDLControllerButtonDpadDown = 12 SDLControllerButtonDpadLeft = 13 SDLControllerButtonDpadRight = 14 SDLControllerButtonMisc1 = 15 SDLControllerButtonPaddle1 = 16 SDLControllerButtonPaddle2 = 17 SDLControllerButtonPaddle3 = 18 SDLControllerButtonPaddle4 = 19 SDLControllerButtonTouchpad = 20 SDLControllerButtonMax = SDLControllerButtonTouchpad // This is different from the original SDL_CONTROLLER_BUTTON_MAX. )
View Source
const ( SDLControllerAxisLeftX = 0 SDLControllerAxisLeftY = 1 SDLControllerAxisRightX = 2 SDLControllerAxisRightY = 3 SDLControllerAxisTriggerLeft = 4 SDLControllerAxisTriggerRight = 5 )
View Source
const ButtonPressedThreshold = 30.0 / 255.0
ButtonPressedThreshold represents the value up to which a button counts as not yet pressed. This has been set to match XInput's trigger dead zone. See https://source.chromium.org/chromium/chromium/src/+/main:device/gamepad/public/cpp/gamepad.h;l=22-23;drc=6997f8a177359bb99598988ed5e900841984d242 Note: should be used with >, not >=, comparisons.
Variables ¶
This section is empty.
Functions ¶
func HasStandardAxis ¶ added in v2.4.0
func HasStandardAxis(id string, axis StandardAxis) bool
func HasStandardButton ¶ added in v2.4.0
func HasStandardButton(id string, button StandardButton) bool
func IsStandardButtonPressed ¶ added in v2.7.0
func IsStandardButtonPressed(id string, button StandardButton, state GamepadState) bool
func StandardAxisValue ¶ added in v2.7.0
func StandardAxisValue(id string, axis StandardAxis, state GamepadState) float64
func StandardButtonValue ¶ added in v2.7.0
func StandardButtonValue(id string, button StandardButton, state GamepadState) float64
Types ¶
type GamepadState ¶
type StandardAxis ¶ added in v2.3.0
type StandardAxis int
const ( StandardAxisLeftStickHorizontal StandardAxis = iota StandardAxisLeftStickVertical StandardAxisRightStickHorizontal StandardAxisRightStickVertical StandardAxisMax = StandardAxisRightStickVertical )
type StandardButton ¶ added in v2.3.0
type StandardButton int
const ( StandardButtonRightBottom StandardButton = iota StandardButtonRightRight StandardButtonRightLeft StandardButtonRightTop StandardButtonFrontTopLeft StandardButtonFrontTopRight StandardButtonFrontBottomLeft StandardButtonFrontBottomRight StandardButtonCenterLeft StandardButtonCenterRight StandardButtonLeftStick StandardButtonRightStick StandardButtonLeftTop StandardButtonLeftBottom StandardButtonLeftLeft StandardButtonLeftRight StandardButtonCenterCenter StandardButtonMax = StandardButtonCenterCenter )
Click to show internal directories.
Click to hide internal directories.