mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
internal/gamepaddb: fix some button assignments for Android
Updates #2309
This commit is contained in:
parent
d66c599938
commit
f414e25b9d
@ -633,41 +633,43 @@ func addAndroidDefaultMappings(id string) bool {
|
|||||||
gamepadButtonMappings[id] = map[StandardButton]*mapping{}
|
gamepadButtonMappings[id] = map[StandardButton]*mapping{}
|
||||||
gamepadAxisMappings[id] = map[StandardAxis]*mapping{}
|
gamepadAxisMappings[id] = map[StandardAxis]*mapping{}
|
||||||
|
|
||||||
|
// For mappings, see mobile/ebitenmobileview/input_android.go.
|
||||||
|
|
||||||
if buttonMask&(1<<SDLControllerButtonA) != 0 {
|
if buttonMask&(1<<SDLControllerButtonA) != 0 {
|
||||||
gamepadButtonMappings[id][StandardButtonRightBottom] = &mapping{
|
gamepadButtonMappings[id][StandardButtonRightBottom] = &mapping{
|
||||||
Type: mappingTypeButton,
|
Type: mappingTypeButton,
|
||||||
Index: SDLControllerButtonA,
|
Index: 0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if buttonMask&(1<<SDLControllerButtonB) != 0 {
|
if buttonMask&(1<<SDLControllerButtonB) != 0 {
|
||||||
gamepadButtonMappings[id][StandardButtonRightRight] = &mapping{
|
gamepadButtonMappings[id][StandardButtonRightRight] = &mapping{
|
||||||
Type: mappingTypeButton,
|
Type: mappingTypeButton,
|
||||||
Index: SDLControllerButtonB,
|
Index: 1,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Use the back button as "B" for easy UI navigation with TV remotes.
|
// Use the back button as "B" for easy UI navigation with TV remotes.
|
||||||
gamepadButtonMappings[id][StandardButtonRightRight] = &mapping{
|
gamepadButtonMappings[id][StandardButtonRightRight] = &mapping{
|
||||||
Type: mappingTypeButton,
|
Type: mappingTypeButton,
|
||||||
Index: SDLControllerButtonBack,
|
Index: 13,
|
||||||
}
|
}
|
||||||
buttonMask &^= uint16(1) << SDLControllerButtonBack
|
buttonMask &^= uint16(1) << SDLControllerButtonBack
|
||||||
}
|
}
|
||||||
if buttonMask&(1<<SDLControllerButtonX) != 0 {
|
if buttonMask&(1<<SDLControllerButtonX) != 0 {
|
||||||
gamepadButtonMappings[id][StandardButtonRightLeft] = &mapping{
|
gamepadButtonMappings[id][StandardButtonRightLeft] = &mapping{
|
||||||
Type: mappingTypeButton,
|
Type: mappingTypeButton,
|
||||||
Index: SDLControllerButtonX,
|
Index: 3,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if buttonMask&(1<<SDLControllerButtonY) != 0 {
|
if buttonMask&(1<<SDLControllerButtonY) != 0 {
|
||||||
gamepadButtonMappings[id][StandardButtonRightTop] = &mapping{
|
gamepadButtonMappings[id][StandardButtonRightTop] = &mapping{
|
||||||
Type: mappingTypeButton,
|
Type: mappingTypeButton,
|
||||||
Index: SDLControllerButtonY,
|
Index: 4,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if buttonMask&(1<<SDLControllerButtonBack) != 0 {
|
if buttonMask&(1<<SDLControllerButtonBack) != 0 {
|
||||||
gamepadButtonMappings[id][StandardButtonCenterLeft] = &mapping{
|
gamepadButtonMappings[id][StandardButtonCenterLeft] = &mapping{
|
||||||
Type: mappingTypeButton,
|
Type: mappingTypeButton,
|
||||||
Index: SDLControllerButtonBack,
|
Index: 13,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if buttonMask&(1<<SDLControllerButtonGuide) != 0 {
|
if buttonMask&(1<<SDLControllerButtonGuide) != 0 {
|
||||||
@ -681,33 +683,36 @@ func addAndroidDefaultMappings(id string) bool {
|
|||||||
if buttonMask&(1<<SDLControllerButtonStart) != 0 {
|
if buttonMask&(1<<SDLControllerButtonStart) != 0 {
|
||||||
gamepadButtonMappings[id][StandardButtonCenterRight] = &mapping{
|
gamepadButtonMappings[id][StandardButtonCenterRight] = &mapping{
|
||||||
Type: mappingTypeButton,
|
Type: mappingTypeButton,
|
||||||
Index: SDLControllerButtonStart,
|
Index: 12,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if buttonMask&(1<<SDLControllerButtonLeftStick) != 0 {
|
if buttonMask&(1<<SDLControllerButtonLeftStick) != 0 {
|
||||||
gamepadButtonMappings[id][StandardButtonLeftStick] = &mapping{
|
gamepadButtonMappings[id][StandardButtonLeftStick] = &mapping{
|
||||||
Type: mappingTypeButton,
|
Type: mappingTypeButton,
|
||||||
Index: SDLControllerButtonLeftStick,
|
Index: 10,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if buttonMask&(1<<SDLControllerButtonRightStick) != 0 {
|
if buttonMask&(1<<SDLControllerButtonRightStick) != 0 {
|
||||||
gamepadButtonMappings[id][StandardButtonRightStick] = &mapping{
|
gamepadButtonMappings[id][StandardButtonRightStick] = &mapping{
|
||||||
Type: mappingTypeButton,
|
Type: mappingTypeButton,
|
||||||
Index: SDLControllerButtonRightStick,
|
Index: 11,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if buttonMask&(1<<SDLControllerButtonLeftShoulder) != 0 {
|
if buttonMask&(1<<SDLControllerButtonLeftShoulder) != 0 {
|
||||||
gamepadButtonMappings[id][StandardButtonFrontTopLeft] = &mapping{
|
gamepadButtonMappings[id][StandardButtonFrontTopLeft] = &mapping{
|
||||||
Type: mappingTypeButton,
|
Type: mappingTypeButton,
|
||||||
Index: SDLControllerButtonLeftShoulder,
|
Index: 6,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if buttonMask&(1<<SDLControllerButtonRightShoulder) != 0 {
|
if buttonMask&(1<<SDLControllerButtonRightShoulder) != 0 {
|
||||||
gamepadButtonMappings[id][StandardButtonFrontTopRight] = &mapping{
|
gamepadButtonMappings[id][StandardButtonFrontTopRight] = &mapping{
|
||||||
Type: mappingTypeButton,
|
Type: mappingTypeButton,
|
||||||
Index: SDLControllerButtonRightShoulder,
|
Index: 7,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Assign DPAD buttons correctly (#2308).
|
||||||
|
|
||||||
if buttonMask&(1<<SDLControllerButtonDpadUp) != 0 {
|
if buttonMask&(1<<SDLControllerButtonDpadUp) != 0 {
|
||||||
gamepadButtonMappings[id][StandardButtonLeftTop] = &mapping{
|
gamepadButtonMappings[id][StandardButtonLeftTop] = &mapping{
|
||||||
Type: mappingTypeButton,
|
Type: mappingTypeButton,
|
||||||
|
Loading…
Reference in New Issue
Block a user