internal/gamepad: remove nativeGamepad.present

This commit is contained in:
Hajime Hoshi 2022-01-30 18:59:25 +09:00
parent 84e53d4c61
commit e261951946
3 changed files with 1 additions and 13 deletions

View File

@ -71,7 +71,7 @@ func (g *gamepads) appendGamepadIDs(ids []driver.GamepadID) []driver.GamepadID {
defer g.m.Unlock() defer g.m.Unlock()
for i, gp := range g.gamepads { for i, gp := range g.gamepads {
if gp != nil && gp.present() { if gp != nil {
ids = append(ids, driver.GamepadID(i)) ids = append(ids, driver.GamepadID(i))
} }
} }

View File

@ -106,15 +106,7 @@ func (e elements) Swap(i, j int) {
e[i], e[j] = e[j], e[i] e[i], e[j] = e[j], e[i]
} }
func (g *nativeGamepad) present() bool {
return g.device != 0
}
func (g *nativeGamepad) elementValue(e *element) int { func (g *nativeGamepad) elementValue(e *element) int {
if g.device == 0 {
return 0
}
var valueRef C.IOHIDValueRef var valueRef C.IOHIDValueRef
if C.IOHIDDeviceGetValue(g.device, e.native, &valueRef) == C.kIOReturnSuccess { if C.IOHIDDeviceGetValue(g.device, e.native, &valueRef) == C.kIOReturnSuccess {
return int(C.IOHIDValueGetIntegerValue(valueRef)) return int(C.IOHIDValueGetIntegerValue(valueRef))

View File

@ -98,10 +98,6 @@ type nativeGamepad struct {
mapping string mapping string
} }
func (g *nativeGamepad) present() bool {
return g.value.Truthy()
}
func (g *nativeGamepad) hasOwnStandardLayoutMapping() bool { func (g *nativeGamepad) hasOwnStandardLayoutMapping() bool {
// With go2cpp, the controller must have the standard // With go2cpp, the controller must have the standard
if go2cpp.Truthy() { if go2cpp.Truthy() {