mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
input: Rename GamepadGUID -> GamepadSDLID (#1049)
Gamepad GUID is a SDL specific notion and, strictly speaking, they are not GUID (UUID) since they don't follow UUID's specifications. Renaming the function makes the situation clearer. Updates #1048
This commit is contained in:
parent
68d58d7452
commit
b4819c4523
11
input.go
11
input.go
@ -92,13 +92,14 @@ func IsMouseButtonPressed(mouseButton MouseButton) bool {
|
||||
return uiDriver().Input().IsMouseButtonPressed(driver.MouseButton(mouseButton))
|
||||
}
|
||||
|
||||
// GamepadGUID returns a string with the uuid.
|
||||
// GamepadSDLID returns a string with the GUID generated in the same way as SDL.
|
||||
// To detect devices, see also the community project of gamepad devices database: https://github.com/gabomdq/SDL_GameControllerDB
|
||||
//
|
||||
// GamepadGUID always returns an empty string on browsers and mobiles.
|
||||
// GamepadSDLID always returns an empty string on browsers and mobiles.
|
||||
//
|
||||
// GamepadGUID is concurrent-safe.
|
||||
func GamepadGUID(id int) string {
|
||||
return uiDriver().Input().GamepadGUID(id)
|
||||
// GamepadSDLID is concurrent-safe.
|
||||
func GamepadSDLID(id int) string {
|
||||
return uiDriver().Input().GamepadSDLID(id)
|
||||
}
|
||||
|
||||
// GamepadName returns a string with the name.
|
||||
|
@ -16,7 +16,7 @@ package driver
|
||||
|
||||
type Input interface {
|
||||
CursorPosition() (x, y int)
|
||||
GamepadGUID(id int) string
|
||||
GamepadSDLID(id int) string
|
||||
GamepadName(id int) string
|
||||
GamepadAxis(id int, axis int) float64
|
||||
GamepadAxisNum(id int) int
|
||||
|
@ -87,7 +87,7 @@ func (i *Input) GamepadIDs() []int {
|
||||
return r
|
||||
}
|
||||
|
||||
func (i *Input) GamepadGUID(id int) string {
|
||||
func (i *Input) GamepadSDLID(id int) string {
|
||||
if !i.ui.isRunning() {
|
||||
return ""
|
||||
}
|
||||
@ -356,6 +356,7 @@ func (i *Input) update(window *glfw.Window, context driver.UIContext) {
|
||||
continue
|
||||
}
|
||||
i.gamepads[id].valid = true
|
||||
// Note that GLFW's gamepad GUID follows SDL's GUID.
|
||||
i.gamepads[id].guid = id.GetGUID()
|
||||
i.gamepads[id].name = id.GetName()
|
||||
|
||||
|
@ -57,7 +57,9 @@ func (i *Input) CursorPosition() (x, y int) {
|
||||
return int(xf), int(yf)
|
||||
}
|
||||
|
||||
func (i *Input) GamepadGUID(id int) string {
|
||||
func (i *Input) GamepadSDLID(id int) string {
|
||||
// TODO: Implement this. See the implementation of SDL:
|
||||
// https://github.com/spurious/SDL-mirror/blob/master/src/joystick/emscripten/SDL_sysjoystick.c
|
||||
return ""
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ func (i *Input) GamepadIDs() []int {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (i *Input) GamepadGUID(id int) string {
|
||||
func (i *Input) GamepadSDLID(id int) string {
|
||||
return ""
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user