input

package
Version: v0.0.0-...-d1ed616 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2016 License: MIT Imports: 3 Imported by: 1

Documentation

Overview

Package input provides functions that can be used to handle input devices on your game

Index

Constants

View Source
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 Clean

func Clean()

Clean removes every used joystick

func HandleEvents

func HandleEvents(e sdl.Event)

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 Key

func Key(key sdl.Scancode) bool

Key returns the state of a keyboard button

func Mouse

func Mouse(button uint8) bool

Mouse returns the state of a mouse button. Use the MOUSE_* constants to know what button it is

func MouseLocation

func MouseLocation() vec2.T

MouseLocation returns the mouse location relative to the window in a 2D Vector

Types

This section is empty.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL