Joystick (Deutsch)
Available since LÖVE 0.9.0 |
This type is not supported in earlier versions. |
Repräsentiert einen realen Joystick.
Konstruktoren
None.
Funktionen
Object:type (Deutsch) | Gibt den Typ des Objekts als String zurück. | ||
Object:typeOf (Deutsch) | Überprüft ob ein Objekt einem bestimmten Datentypen angehört. |
Aufzählungstypen
Supertypen
Beispiele
Display the last button pressed of a controller on-screen
local lastbutton = "none" function love.gamepadpressed(joystick, button) lastbutton = button end function love.draw() love.graphics.print("Last gamepad button pressed: "..lastbutton, 10, 10) end
Move a circle with the d-pad of a controller
function love.load() local joysticks = love.joystick.getJoysticks() joystick = joysticks[1] position = {x = 400, y = 300} speed = 300 end function love.update(dt) if not joystick then return end if joystick:isGamepadDown("dpleft") then position.x = position.x - speed * dt elseif joystick:isGamepadDown("dpright") then position.x = position.x + speed * dt end if joystick:isGamepadDown("dpup") then position.y = position.y - speed * dt elseif joystick:isGamepadDown("dpdown") then position.y = position.y + speed * dt end end function love.draw() love.graphics.circle("fill", position.x, position.y, 50) end
Siehe auch
- love.joystickadded
- love.joystickremoved
- love.joystickpressed
- love.joystickreleased
- love.joystickaxis
- love.joystickhat
Andere Sprachen
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