Replies: 2 comments 4 replies
-
The button name is based on the Web standard. This might be weird but this should be universal and stable. I don't plan to change the names so far. If you really want to have a better name, you can define constants by yourself.
This has different meanings between Nintendo Switch and Xbox, right? |
Beta Was this translation helpful? Give feedback.
4 replies
-
Maybe others will find it useful. I made the following constants/mapping to make it easier for myself: type GamepadButton int
const (
GamepadButtonDPadUp = iota
GamepadButtonDPadDown
GamepadButtonDPadLeft
GamepadButtonDPadRight
GamepadButtonTop // Y (Xbox), triangle (PS)
GamepadButtonBottom // A (Xbox), cross (PS)
GamepadButtonLeft // X (Xbox), square (PS)
GamepadButtonRight // B (Xbox), circle (PS)
GamepadButtonLeftShoulder // L1
GamepadButtonRightShoulder // R1
GamepadButtonLeftTrigger // L2
GamepadButtonRightTrigger // R2
GamepadButtonSelect // Share on PS
GamepadButtonStart // Options on PS
GamepadButtonLeftStick // L3 on PS
GamepadButtonRightStick // R3 on PS
GamepadButtonHome
)
var gamepadButtonToEbitenStandardButton = map[GamepadButton]ebiten.StandardGamepadButton{
GamepadButtonDPadUp: ebiten.StandardGamepadButtonLeftTop,
GamepadButtonDPadDown: ebiten.StandardGamepadButtonLeftBottom,
GamepadButtonDPadLeft: ebiten.StandardGamepadButtonLeftLeft,
GamepadButtonDPadRight: ebiten.StandardGamepadButtonLeftRight,
GamepadButtonTop: ebiten.StandardGamepadButtonRightTop,
GamepadButtonBottom: ebiten.StandardGamepadButtonRightBottom,
GamepadButtonLeft: ebiten.StandardGamepadButtonRightLeft,
GamepadButtonRight: ebiten.StandardGamepadButtonRightRight,
GamepadButtonLeftShoulder: ebiten.StandardGamepadButtonFrontTopLeft,
GamepadButtonRightShoulder: ebiten.StandardGamepadButtonFrontTopRight,
GamepadButtonLeftTrigger: ebiten.StandardGamepadButtonFrontBottomLeft,
GamepadButtonRightTrigger: ebiten.StandardGamepadButtonFrontBottomRight,
GamepadButtonSelect: ebiten.StandardGamepadButtonCenterLeft,
GamepadButtonStart: ebiten.StandardGamepadButtonCenterRight,
GamepadButtonLeftStick: ebiten.StandardGamepadButtonLeftStick,
GamepadButtonRightStick: ebiten.StandardGamepadButtonRightStick,
GamepadButtonHome: ebiten.StandardGamepadButtonCenterCenter,
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello!
Would it be possible to rename the standard gamepad constants to be something a bit more understandable? "StandardGamepadButtonRightBottom" is perfectly functional, but "StandardGamepadA" or "StandardGamepadCross" is easier to immediately understand. While it would, of course, be different depending on what gamepad you're using, I think it's easier to mentally translate controller constants that refer to an Xbox layout to a PS layout (or vice-versa) over translating what "StandardGamepadButtonLeftTop" is referring to. Using "StandardGamepadFront*" to refer to the shoulder button area is also a bit weird to wrap my mind around.
Beta Was this translation helpful? Give feedback.
All reactions