mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
internal/gamepad: add comments
This commit is contained in:
parent
71e17efd80
commit
d3cf8935e8
@ -90,6 +90,8 @@ func (g *gamepads) get(id driver.GamepadID) *Gamepad {
|
||||
return g.gamepads[id]
|
||||
}
|
||||
|
||||
// find can be invoked from callbacks on the OS's main thread.
|
||||
// As a callback can be called synchronously from update, using a mutex is not a good idea.
|
||||
func (g *gamepads) find(cond func(*Gamepad) bool) *Gamepad {
|
||||
for _, gp := range g.gamepads {
|
||||
if gp == nil {
|
||||
@ -102,6 +104,8 @@ func (g *gamepads) find(cond func(*Gamepad) bool) *Gamepad {
|
||||
return nil
|
||||
}
|
||||
|
||||
// add can be invoked from callbacks on the OS's main thread.
|
||||
// As a callback can be called synchronously from update, using a mutex is not a good idea.
|
||||
func (g *gamepads) add(name, sdlID string) *Gamepad {
|
||||
for i, gp := range g.gamepads {
|
||||
if gp == nil {
|
||||
@ -122,6 +126,8 @@ func (g *gamepads) add(name, sdlID string) *Gamepad {
|
||||
return gp
|
||||
}
|
||||
|
||||
// remove can be invoked from callbacks on the OS's main thread.
|
||||
// As a callback can be called synchronously from update, using a mutex is not a good idea.
|
||||
func (g *gamepads) remove(cond func(*Gamepad) bool) {
|
||||
for i, gp := range g.gamepads {
|
||||
if gp == nil {
|
||||
|
Loading…
Reference in New Issue
Block a user