Lutro - Documentation

love.joystick

Provides an interface to connected joysticks

love.joystick.getJoystickCount

Returns the number of joysticks plugged.

num_plugged = love.joystick.getJoystickCount()

love.joystick.isDown

Returns whether a button is pressed.

select_pressed = love.joystick.isDown(1, RETRO_DEVICE_ID_JOYPAD_SELECT)

It is recommanded to define:

RETRO_DEVICE_ID_JOYPAD_B        = 1
RETRO_DEVICE_ID_JOYPAD_Y        = 2
RETRO_DEVICE_ID_JOYPAD_SELECT   = 3
RETRO_DEVICE_ID_JOYPAD_START    = 4
RETRO_DEVICE_ID_JOYPAD_UP       = 5
RETRO_DEVICE_ID_JOYPAD_DOWN     = 6
RETRO_DEVICE_ID_JOYPAD_LEFT     = 7
RETRO_DEVICE_ID_JOYPAD_RIGHT    = 8
RETRO_DEVICE_ID_JOYPAD_A        = 9
RETRO_DEVICE_ID_JOYPAD_X        = 10
RETRO_DEVICE_ID_JOYPAD_L        = 11
RETRO_DEVICE_ID_JOYPAD_R        = 12
RETRO_DEVICE_ID_JOYPAD_L2       = 13
RETRO_DEVICE_ID_JOYPAD_R2       = 14
RETRO_DEVICE_ID_JOYPAD_L3       = 15
RETRO_DEVICE_ID_JOYPAD_R3       = 16

love.joystick.getAxis

Returns the value of an analog axis.

select_pressed = love.joystick.getAxis(1, AXIS_LEFT_X)

It is recommanded to define:

AXIS_LEFT_X  = 1
AXIS_LEFT_Y  = 2
AXIS_RIGHT_X = 3
AXIS_RIGHT_Y = 4