love.joystickaxis
Available since LÖVE 0.9.0 |
This callback is not supported in earlier versions. |
Called when a joystick axis moves.
Contents
Function
Synopsis
love.joystickaxis( joystick, axis, value )
Arguments
Joystick joystick
- The joystick object.
number axis
- The axis number.
number value
- The new axis value.
Returns
Nothing.
Examples
Show the value of the first two joystick axes
local lastAxis1Value = 0
local lastAxis2Value = 0
function love.joystickaxis(joystick, axis, value)
if axis == 1 then
lastAxis1Value = value
elseif axis == 2 then
lastAxis2Value = value
end
end
function love.draw()
love.graphics.print(string.format("Axis 1: %.2f", lastAxis1Value), 100, 100)
love.graphics.print(string.format("Axis 2: %.2f", lastAxis2Value), 100, 120)
end
See Also
Other Languages
Dansk –
Deutsch –
English –
Español –
Français –
Indonesia –
Italiano –
Lietuviškai –
Magyar –
Nederlands –
Polski –
Português –
Română –
Slovenský –
Suomi –
Svenska –
Türkçe –
Česky –
Ελληνικά –
Български –
Русский –
Српски –
Українська –
עברית –
ไทย –
日本語 –
正體中文 –
简体中文 –
Tiếng Việt –
한국어
More info