mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 02:38:53 +01:00
Remove exp/gamepad
This commit is contained in:
parent
811eb9cb9a
commit
15a523c42b
@ -12,11 +12,11 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// Package gamepad offers abstract gamepad buttons and configuration.
|
||||
package gamepad
|
||||
package blocks
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/hajimehoshi/ebiten"
|
||||
)
|
||||
|
@ -16,22 +16,21 @@ package blocks
|
||||
|
||||
import (
|
||||
"github.com/hajimehoshi/ebiten"
|
||||
"github.com/hajimehoshi/ebiten/exp/gamepad"
|
||||
)
|
||||
|
||||
var gamepadStdButtons = []gamepad.StdButton{
|
||||
gamepad.StdButtonLL,
|
||||
gamepad.StdButtonLR,
|
||||
gamepad.StdButtonLD,
|
||||
gamepad.StdButtonRD,
|
||||
gamepad.StdButtonRR,
|
||||
var gamepadStdButtons = []StdButton{
|
||||
StdButtonLL,
|
||||
StdButtonLR,
|
||||
StdButtonLD,
|
||||
StdButtonRD,
|
||||
StdButtonRR,
|
||||
}
|
||||
|
||||
type Input struct {
|
||||
keyStates [256]int
|
||||
gamepadButtonStates [256]int
|
||||
gamepadStdButtonStates [16]int
|
||||
gamepadConfig gamepad.Configuration
|
||||
gamepadConfig Configuration
|
||||
}
|
||||
|
||||
func (i *Input) StateForKey(key ebiten.Key) int {
|
||||
@ -42,7 +41,7 @@ func (i *Input) StateForGamepadButton(b ebiten.GamepadButton) int {
|
||||
return i.gamepadButtonStates[b]
|
||||
}
|
||||
|
||||
func (i *Input) stateForGamepadStdButton(b gamepad.StdButton) int {
|
||||
func (i *Input) stateForGamepadStdButton(b StdButton) int {
|
||||
return i.gamepadStdButtonStates[b]
|
||||
}
|
||||
|
||||
@ -77,14 +76,14 @@ func (i *Input) IsRotateRightTrigger() bool {
|
||||
if i.StateForKey(ebiten.KeySpace) == 1 || i.StateForKey(ebiten.KeyX) == 1 {
|
||||
return true
|
||||
}
|
||||
return i.stateForGamepadStdButton(gamepad.StdButtonRR) == 1
|
||||
return i.stateForGamepadStdButton(StdButtonRR) == 1
|
||||
}
|
||||
|
||||
func (i *Input) IsRotateLeftTrigger() bool {
|
||||
if i.StateForKey(ebiten.KeyZ) == 1 {
|
||||
return true
|
||||
}
|
||||
return i.stateForGamepadStdButton(gamepad.StdButtonRD) == 1
|
||||
return i.stateForGamepadStdButton(StdButtonRD) == 1
|
||||
}
|
||||
|
||||
func (i *Input) StateForLeft() int {
|
||||
@ -92,7 +91,7 @@ func (i *Input) StateForLeft() int {
|
||||
if 0 < v {
|
||||
return v
|
||||
}
|
||||
return i.stateForGamepadStdButton(gamepad.StdButtonLL)
|
||||
return i.stateForGamepadStdButton(StdButtonLL)
|
||||
}
|
||||
|
||||
func (i *Input) StateForRight() int {
|
||||
@ -100,7 +99,7 @@ func (i *Input) StateForRight() int {
|
||||
if 0 < v {
|
||||
return v
|
||||
}
|
||||
return i.stateForGamepadStdButton(gamepad.StdButtonLR)
|
||||
return i.stateForGamepadStdButton(StdButtonLR)
|
||||
}
|
||||
|
||||
func (i *Input) StateForDown() int {
|
||||
@ -108,5 +107,5 @@ func (i *Input) StateForDown() int {
|
||||
if 0 < v {
|
||||
return v
|
||||
}
|
||||
return i.stateForGamepadStdButton(gamepad.StdButtonLD)
|
||||
return i.stateForGamepadStdButton(StdButtonLD)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user