internal/gamepad: refactoring

Updates #2311
This commit is contained in:
Hajime Hoshi 2022-09-11 22:44:02 +09:00
parent 4629306f4b
commit 89598df520

View File

@ -392,6 +392,7 @@ import "C"
import ( import (
"encoding/hex" "encoding/hex"
"unsafe"
) )
//export ebitenAddGamepad //export ebitenAddGamepad
@ -409,7 +410,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 := hex.EncodeToString([]byte(C.GoStringN(&prop.guid[0], 16))) sdlID := hex.EncodeToString(C.GoBytes(unsafe.Pointer(&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),