Mark API as experimental

This commit is contained in:
Humphrey Shotton 2019-01-10 19:25:55 +00:00
parent 52b4384240
commit 026878de07
1 changed files with 16 additions and 4 deletions

View File

@ -28,50 +28,62 @@ const (
) )
// JoystickPresent returns if the joystick is currently connected. // JoystickPresent returns if the joystick is currently connected.
//
// This API is experimental.
func (w *Window) JoystickPresent(js Joystick) bool { func (w *Window) JoystickPresent(js Joystick) bool {
return w.currJoy.connected[js] return w.currJoy.connected[js]
} }
// JoystickName returns the name of the joystick. A disconnected joystick will return an // JoystickName returns the name of the joystick. A disconnected joystick will return an
// empty string. // empty string.
//
// This API is experimental.
func (w *Window) JoystickName(js Joystick) string { func (w *Window) JoystickName(js Joystick) string {
return w.currJoy.name[js] return w.currJoy.name[js]
} }
// JoystickButtonCount returns the number of buttons a connected joystick has. // JoystickButtonCount returns the number of buttons a connected joystick has.
//
// This API is experimental.
func (w *Window) JoystickButtonCount(js Joystick) int { func (w *Window) JoystickButtonCount(js Joystick) int {
return len(w.currJoy.buttons[js]) return len(w.currJoy.buttons[js])
} }
// JoystickAxisCount returns the number of axes a connected joystick has. // JoystickAxisCount returns the number of axes a connected joystick has.
//
// This API is experimental.
func (w *Window) JoystickAxisCount(js Joystick) int { func (w *Window) JoystickAxisCount(js Joystick) int {
return len(w.currJoy.axis[js]) return len(w.currJoy.axis[js])
} }
// JoystickPressed returns whether the joystick Button is currently pressed down. // JoystickPressed returns whether the joystick Button is currently pressed down.
//
// If the button index is out of range, this will return false. // If the button index is out of range, this will return false.
//
// This API is experimental.
func (w *Window) JoystickPressed(js Joystick, button int) bool { func (w *Window) JoystickPressed(js Joystick, button int) bool {
return w.currJoy.getButton(js, button) return w.currJoy.getButton(js, button)
} }
// JoystickJustPressed returns whether the joystick Button has just been pressed down. // JoystickJustPressed returns whether the joystick Button has just been pressed down.
//
// If the button index is out of range, this will return false. // If the button index is out of range, this will return false.
//
// This API is experimental.
func (w *Window) JoystickJustPressed(js Joystick, button int) bool { func (w *Window) JoystickJustPressed(js Joystick, button int) bool {
return w.currJoy.getButton(js, button) && !w.prevJoy.getButton(js, button) return w.currJoy.getButton(js, button) && !w.prevJoy.getButton(js, button)
} }
// JoystickJustReleased returns whether the joystick Button has just been released up. // JoystickJustReleased returns whether the joystick Button has just been released up.
//
// If the button index is out of range, this will return false. // If the button index is out of range, this will return false.
//
// This API is experimental.
func (w *Window) JoystickJustReleased(js Joystick, button int) bool { func (w *Window) JoystickJustReleased(js Joystick, button int) bool {
return !w.currJoy.getButton(js, button) && w.prevJoy.getButton(js, button) return !w.currJoy.getButton(js, button) && w.prevJoy.getButton(js, button)
} }
// JoystickAxis returns the value of a joystick axis at the last call to Window.Update. // JoystickAxis returns the value of a joystick axis at the last call to Window.Update.
//
// If the axis index is out of range, this will return 0. // If the axis index is out of range, this will return 0.
//
// This API is experimental.
func (w *Window) JoystickAxis(js Joystick, axis int) float64 { func (w *Window) JoystickAxis(js Joystick, axis int) float64 {
return w.currJoy.getAxis(js, axis) return w.currJoy.getAxis(js, axis)
} }