Code: Select all
function love.touchpressed(x, y, i)
Parameters:
x: Array/List with all x parameters
y: Array/List with all y parameters
i: Index of event that triggered the event; 0 if this feature is not supported
Code: Select all
function love.touchreleased(x, y, i)
Parameters:
x: Array/List with all x parameters
y: Array/List with all y parameters
i: Index of event that triggered the event; 0 if this feature is not supported
Code: Select all
function love.touchmove(x, y, i)
Parameters:
x: Array/List with all x parameters
y: Array/List with all y parameters
i: Index of event that triggered the event; 0 if this feature is not supported
Sensors:
Sensors do a nice Android live cycle and disable if the screen turns off or if the user quits the application. This is to reduce power consumption.
Code: Select all
function love.sensor.enable(s)
Parameter:
s: Name of the sensor, possible values are any sensor values from Android according to your Android version. Please use the name as string, e.g. "TYPE_ALL".
Code: Select all
function love.sensor.disable(s)
Parameter:
s: Name of the sensor, possible values are any sensor values from Android according to your Android version. Please use the name as string, e.g. "TYPE_ALL".
Code: Select all
function love.sensorchanged(n,t,v)
Parameters:
n: Name of the sensor (String).
t: Type of the sensor (String) according to Android sensor names.
v: Values according to the sensor type. Provided as float array.
Example Touch:
Code: Select all
function love.touchpressed(x, y, i)
print("love.touchpressed", i)
print("x")
for index,val in pairs(x) do
print(index, "->", val)
end
print("y")
for index,val in pairs(y) do
print(index, "->", val)
end
end
function love.touchreleased(x, y, i)
print("love.touchreleased", i)
print("x")
for index,val in pairs(x) do
print(index, "->", val)
end
print("y")
for index,val in pairs(y) do
print(index, "->", val)
end
end
function love.touchmove(x, y, i)
print("love.touchmove", i)
print("x")
for index,val in pairs(x) do
print(index, "->", val)
end
print("y")
for index,val in pairs(y) do
print(index, "->", val)
end
end
Code: Select all
function love.load()
love.sensor.enable("TYPE_ALL")
end
function love.sensorchanged(n,t,v)
print(n, t)
for index, val in pairs(v) do
print(index, "->", val)
end
end