mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 19:28:57 +01:00
internal/gamepad: bug fix: wrong SDL ID on iOS
The gamepad database already worked well with this fix. Closes #2311
This commit is contained in:
parent
eec944f5ed
commit
4629306f4b
@ -390,6 +390,10 @@ package gamepad
|
|||||||
// }
|
// }
|
||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/hex"
|
||||||
|
)
|
||||||
|
|
||||||
//export ebitenAddGamepad
|
//export ebitenAddGamepad
|
||||||
func ebitenAddGamepad(controller C.uintptr_t, prop *C.struct_ControllerProperty) {
|
func ebitenAddGamepad(controller C.uintptr_t, prop *C.struct_ControllerProperty) {
|
||||||
theGamepads.addIOSGamepad(controller, prop)
|
theGamepads.addIOSGamepad(controller, prop)
|
||||||
@ -405,7 +409,7 @@ func (g *gamepads) addIOSGamepad(controller C.uintptr_t, prop *C.struct_Controll
|
|||||||
defer g.m.Unlock()
|
defer g.m.Unlock()
|
||||||
|
|
||||||
name := C.GoString(&prop.name[0])
|
name := C.GoString(&prop.name[0])
|
||||||
sdlID := C.GoStringN(&prop.guid[0], 16)
|
sdlID := hex.EncodeToString([]byte(C.GoStringN(&prop.guid[0], 16)))
|
||||||
gp := g.add(name, sdlID)
|
gp := g.add(name, sdlID)
|
||||||
gp.native = &nativeGamepadImpl{
|
gp.native = &nativeGamepadImpl{
|
||||||
controller: uintptr(controller),
|
controller: uintptr(controller),
|
||||||
|
Loading…
Reference in New Issue
Block a user