mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-24 18:02:02 +01:00
internal/gamepaddb: rename functions
This commit is contained in:
parent
6cdabf09d1
commit
047858aa59
@ -356,7 +356,7 @@ func (g *Gamepad) IsStandardButtonAvailable(button gamepaddb.StandardButton) boo
|
||||
// StandardAxisValue is concurrent-safe.
|
||||
func (g *Gamepad) StandardAxisValue(axis gamepaddb.StandardAxis) float64 {
|
||||
if gamepaddb.HasStandardLayoutMapping(g.sdlID) {
|
||||
return gamepaddb.AxisValue(g.sdlID, axis, g)
|
||||
return gamepaddb.StandardAxisValue(g.sdlID, axis, g)
|
||||
}
|
||||
if m := g.native.standardAxisInOwnMapping(axis); m != nil {
|
||||
return m.Value()*2 - 1
|
||||
@ -367,7 +367,7 @@ func (g *Gamepad) StandardAxisValue(axis gamepaddb.StandardAxis) float64 {
|
||||
// StandardButtonValue is concurrent-safe.
|
||||
func (g *Gamepad) StandardButtonValue(button gamepaddb.StandardButton) float64 {
|
||||
if gamepaddb.HasStandardLayoutMapping(g.sdlID) {
|
||||
return gamepaddb.ButtonValue(g.sdlID, button, g)
|
||||
return gamepaddb.StandardButtonValue(g.sdlID, button, g)
|
||||
}
|
||||
if m := g.native.standardButtonInOwnMapping(button); m != nil {
|
||||
return m.Value()
|
||||
@ -378,7 +378,7 @@ func (g *Gamepad) StandardButtonValue(button gamepaddb.StandardButton) float64 {
|
||||
// IsStandardButtonPressed is concurrent-safe.
|
||||
func (g *Gamepad) IsStandardButtonPressed(button gamepaddb.StandardButton) bool {
|
||||
if gamepaddb.HasStandardLayoutMapping(g.sdlID) {
|
||||
return gamepaddb.IsButtonPressed(g.sdlID, button, g)
|
||||
return gamepaddb.IsStandardButtonPressed(g.sdlID, button, g)
|
||||
}
|
||||
if m := g.native.standardButtonInOwnMapping(button); m != nil {
|
||||
return m.Pressed()
|
||||
|
@ -413,7 +413,7 @@ func HasStandardAxis(id string, axis StandardAxis) bool {
|
||||
return mappings[axis] != nil
|
||||
}
|
||||
|
||||
func AxisValue(id string, axis StandardAxis, state GamepadState) float64 {
|
||||
func StandardAxisValue(id string, axis StandardAxis, state GamepadState) float64 {
|
||||
mappingsM.RLock()
|
||||
defer mappingsM.RUnlock()
|
||||
|
||||
@ -464,14 +464,14 @@ func HasStandardButton(id string, button StandardButton) bool {
|
||||
return mappings[button] != nil
|
||||
}
|
||||
|
||||
func ButtonValue(id string, button StandardButton, state GamepadState) float64 {
|
||||
func StandardButtonValue(id string, button StandardButton, state GamepadState) float64 {
|
||||
mappingsM.RLock()
|
||||
defer mappingsM.RUnlock()
|
||||
|
||||
return buttonValue(id, button, state)
|
||||
return standardButtonValue(id, button, state)
|
||||
}
|
||||
|
||||
func buttonValue(id string, button StandardButton, state GamepadState) float64 {
|
||||
func standardButtonValue(id string, button StandardButton, state GamepadState) float64 {
|
||||
mappings := buttonMappings(id)
|
||||
if mappings == nil {
|
||||
return 0
|
||||
@ -513,7 +513,7 @@ func buttonValue(id string, button StandardButton, state GamepadState) float64 {
|
||||
// Note: should be used with >, not >=, comparisons.
|
||||
const ButtonPressedThreshold = 30.0 / 255.0
|
||||
|
||||
func IsButtonPressed(id string, button StandardButton, state GamepadState) bool {
|
||||
func IsStandardButtonPressed(id string, button StandardButton, state GamepadState) bool {
|
||||
mappingsM.RLock()
|
||||
defer mappingsM.RUnlock()
|
||||
|
||||
@ -529,7 +529,7 @@ func IsButtonPressed(id string, button StandardButton, state GamepadState) bool
|
||||
|
||||
switch mapping.Type {
|
||||
case mappingTypeAxis:
|
||||
v := buttonValue(id, button, state)
|
||||
v := standardButtonValue(id, button, state)
|
||||
return v > ButtonPressedThreshold
|
||||
case mappingTypeButton:
|
||||
return state.Button(mapping.Index)
|
||||
|
Loading…
Reference in New Issue
Block a user