Skip to content

Commit

Permalink
joystick: correct events used by gamepad-style up/down/left/right but…
Browse files Browse the repository at this point in the history
…tons

Signed-off-by: Ron Evans <[email protected]>
  • Loading branch information
deadprogram committed Apr 18, 2018
1 parent 7546590 commit 3c4c15b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 8 deletions.
12 changes: 12 additions & 0 deletions examples/joystick_ps3.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,18 @@ func main() {
stick.On(joystick.SelectRelease, func(data interface{}) {
fmt.Println("select_release")
})
stick.On(joystick.RightPress, func(data interface{}) {
fmt.Println("right_press")
})
stick.On(joystick.LeftPress, func(data interface{}) {
fmt.Println("left_press")
})
stick.On(joystick.UpPress, func(data interface{}) {
fmt.Println("up_press")
})
stick.On(joystick.DownPress, func(data interface{}) {
fmt.Println("down_press")
})

// joysticks
stick.On(joystick.LeftX, func(data interface{}) {
Expand Down
24 changes: 16 additions & 8 deletions platforms/joystick/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,22 @@ const (
R2Press = "r2_press"
// R1 button release event
R2Release = "r2_release"
// up gamepad event
Up = "up"
// down gamepad event
Down = "down"
// left gamepad event
Left = "left"
// right gamepad event
Right = "right"
// up gamepad press event
UpPress = "up_press"
// up gamepad release event
UpRelease = "up_release"
// down gamepad press event
DownPress = "down_press"
// down gamepad release event
DownRelease = "down_release"
// left gamepad press event
LeftPress = "left_press"
// left gamepad release event
LeftRelease = "left_release"
// right gamepad press event
RightPress = "right_press"
// right gamepad release event
RightRelease = "right_release"
// square button press event
SquarePress = "square_press"
// square button release event
Expand Down

0 comments on commit 3c4c15b

Please sign in to comment.