mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 03:38:55 +01:00
internal/gamepad: remove nativeGamepad.present
This commit is contained in:
parent
84e53d4c61
commit
e261951946
@ -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))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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))
|
||||||
|
@ -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() {
|
||||||
|
Loading…
Reference in New Issue
Block a user