Documentation ¶
Overview ¶
Package input provides functions that can be used to handle input devices on your game
Index ¶
- Constants
- func Axis(id sdl.JoystickID, axis uint) int16
- func Axisf(id sdl.JoystickID, axis uint) float32
- func Button(id sdl.JoystickID, button uint) bool
- func Clean()
- func HandleEvents(e sdl.Event)
- func Hat(id sdl.JoystickID, hat uint) uint8
- func InitJoystick()
- func Key(key sdl.Scancode) bool
- func Mouse(button uint8) bool
- func MouseLocation() vec2.T
Constants ¶
const ( // MOUSE_LEFT is the value for the left mouse button MOUSE_LEFT = 0 // MOUSE_MIDDLE is the value for the middle mouse button ( aka the scrollwheel ) MOUSE_MIDDLE = 1 // MOUSE_RIGHT is the value for the right mouse button MOUSE_RIGHT = 2 // JOYSTICK_HAT_N is the value for the north joystick hat position JOYSTICK_HAT_N = 1 // JOYSTICK_HAT_NE is the value for the north east joystick hat position JOYSTICK_HAT_NE = 3 // JOYSTICK_HAT_E is the value for the east joystick hat position JOYSTICK_HAT_E = 2 // JOYSTICK_HAT_SE is the value for the south east joystick hat position JOYSTICK_HAT_SE = 6 // JOYSTICK_HAT_S is the value for the south joystick hat position JOYSTICK_HAT_S = 4 // JOYSTICK_HAT_SW is the value for the south east joystick hat position JOYSTICK_HAT_SW = 9 // JOYSTICK_HAT_W is the value for the west joystick hat position JOYSTICK_HAT_W = 8 // JOYSTICK_HAT_NW is the value for the north west joystick hat position JOYSTICK_HAT_NW = 12 )
Variables ¶
This section is empty.
Functions ¶
func Axis ¶
func Axis(id sdl.JoystickID, axis uint) int16
Axis returns the Axis value for a certain Joystick's Axis. The returned value is a int16 number usually to show how 'full' the analog trigger are pressed or how far the stick has gone
func Axisf ¶
func Axisf(id sdl.JoystickID, axis uint) float32
Axisf returns the Axis value for a certain Joystick's Axis in float32. The value returns a float32 number that goes from -1 to 1 usually to show how 'full' the analog trigger are pressed or how far the stick has gone
func Button ¶
func Button(id sdl.JoystickID, button uint) bool
Button returns the Joystick's button state
func HandleEvents ¶
HandleEvents handles input device specific events like keyboard input, mouse input, and joystick input
func Hat ¶
func Hat(id sdl.JoystickID, hat uint) uint8
Hat returns the Joystick's hat position. Use the JOYSTICK_HAT_* constants to know what position it's on
func InitJoystick ¶
func InitJoystick()
InitJoystick initializes the Joystick Subsystem and add available joysticks
func Mouse ¶
Mouse returns the state of a mouse button. Use the MOUSE_* constants to know what button it is
func MouseLocation ¶
MouseLocation returns the mouse location relative to the window in a 2D Vector
Types ¶
This section is empty.