From 15a523c42b39ead69907bb57bc3315e52275b193 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sat, 3 Sep 2016 14:03:41 +0900 Subject: [PATCH] Remove exp/gamepad --- .../blocks/blocks}/gamepad.go | 4 +-- examples/blocks/blocks/input.go | 27 +++++++++---------- 2 files changed, 15 insertions(+), 16 deletions(-) rename {exp/gamepad => examples/blocks/blocks}/gamepad.go (97%) diff --git a/exp/gamepad/gamepad.go b/examples/blocks/blocks/gamepad.go similarity index 97% rename from exp/gamepad/gamepad.go rename to examples/blocks/blocks/gamepad.go index 74cca6db3..2b08376b4 100644 --- a/exp/gamepad/gamepad.go +++ b/examples/blocks/blocks/gamepad.go @@ -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" ) diff --git a/examples/blocks/blocks/input.go b/examples/blocks/blocks/input.go index 617f4a38b..7d17cd556 100644 --- a/examples/blocks/blocks/input.go +++ b/examples/blocks/blocks/input.go @@ -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) }