Remove exp/gamepad

This commit is contained in:
Hajime Hoshi 2016-09-03 14:03:41 +09:00
parent 811eb9cb9a
commit 15a523c42b
2 changed files with 15 additions and 16 deletions

View File

@ -12,11 +12,11 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// Package gamepad offers abstract gamepad buttons and configuration. package blocks
package gamepad
import ( import (
"fmt" "fmt"
"github.com/hajimehoshi/ebiten" "github.com/hajimehoshi/ebiten"
) )

View File

@ -16,22 +16,21 @@ package blocks
import ( import (
"github.com/hajimehoshi/ebiten" "github.com/hajimehoshi/ebiten"
"github.com/hajimehoshi/ebiten/exp/gamepad"
) )
var gamepadStdButtons = []gamepad.StdButton{ var gamepadStdButtons = []StdButton{
gamepad.StdButtonLL, StdButtonLL,
gamepad.StdButtonLR, StdButtonLR,
gamepad.StdButtonLD, StdButtonLD,
gamepad.StdButtonRD, StdButtonRD,
gamepad.StdButtonRR, StdButtonRR,
} }
type Input struct { type Input struct {
keyStates [256]int keyStates [256]int
gamepadButtonStates [256]int gamepadButtonStates [256]int
gamepadStdButtonStates [16]int gamepadStdButtonStates [16]int
gamepadConfig gamepad.Configuration gamepadConfig Configuration
} }
func (i *Input) StateForKey(key ebiten.Key) int { func (i *Input) StateForKey(key ebiten.Key) int {
@ -42,7 +41,7 @@ func (i *Input) StateForGamepadButton(b ebiten.GamepadButton) int {
return i.gamepadButtonStates[b] return i.gamepadButtonStates[b]
} }
func (i *Input) stateForGamepadStdButton(b gamepad.StdButton) int { func (i *Input) stateForGamepadStdButton(b StdButton) int {
return i.gamepadStdButtonStates[b] return i.gamepadStdButtonStates[b]
} }
@ -77,14 +76,14 @@ func (i *Input) IsRotateRightTrigger() bool {
if i.StateForKey(ebiten.KeySpace) == 1 || i.StateForKey(ebiten.KeyX) == 1 { if i.StateForKey(ebiten.KeySpace) == 1 || i.StateForKey(ebiten.KeyX) == 1 {
return true return true
} }
return i.stateForGamepadStdButton(gamepad.StdButtonRR) == 1 return i.stateForGamepadStdButton(StdButtonRR) == 1
} }
func (i *Input) IsRotateLeftTrigger() bool { func (i *Input) IsRotateLeftTrigger() bool {
if i.StateForKey(ebiten.KeyZ) == 1 { if i.StateForKey(ebiten.KeyZ) == 1 {
return true return true
} }
return i.stateForGamepadStdButton(gamepad.StdButtonRD) == 1 return i.stateForGamepadStdButton(StdButtonRD) == 1
} }
func (i *Input) StateForLeft() int { func (i *Input) StateForLeft() int {
@ -92,7 +91,7 @@ func (i *Input) StateForLeft() int {
if 0 < v { if 0 < v {
return v return v
} }
return i.stateForGamepadStdButton(gamepad.StdButtonLL) return i.stateForGamepadStdButton(StdButtonLL)
} }
func (i *Input) StateForRight() int { func (i *Input) StateForRight() int {
@ -100,7 +99,7 @@ func (i *Input) StateForRight() int {
if 0 < v { if 0 < v {
return v return v
} }
return i.stateForGamepadStdButton(gamepad.StdButtonLR) return i.stateForGamepadStdButton(StdButtonLR)
} }
func (i *Input) StateForDown() int { func (i *Input) StateForDown() int {
@ -108,5 +107,5 @@ func (i *Input) StateForDown() int {
if 0 < v { if 0 < v {
return v return v
} }
return i.stateForGamepadStdButton(gamepad.StdButtonLD) return i.stateForGamepadStdButton(StdButtonLD)
} }