54 lines
937 B
Lua
54 lines
937 B
Lua
return function(con)
|
|
|
|
local mob = love.system.getOS() == 'Android'
|
|
|
|
m = {
|
|
x = 0, y = 0,
|
|
mx = 0, my = 0,
|
|
b = 0, pb = 0,
|
|
t = os.time(),
|
|
}
|
|
function updM()
|
|
local x, y = love.mouse.getPosition()
|
|
m.mx, m.my = x - m.x, y - m.y
|
|
m.x, m.y = x, y
|
|
|
|
m.pb = m.b
|
|
if love.mouse.isDown(1) then m.b = 1
|
|
elseif love.mouse.isDown(2) then m.b = 2
|
|
elseif love.mouse.isDown(3) then m.b = 3
|
|
else m.b = 0 end
|
|
|
|
if m.b ~= 0 and m.pb == 0
|
|
then m.t = os.time() end
|
|
|
|
if m.pb == 0 and m.b ~= 0
|
|
then m.mx, m.my = 0, 0
|
|
end
|
|
end
|
|
|
|
function love.update(dt)
|
|
updM()
|
|
|
|
if m.b == 0 and m.pb ~= 0 then
|
|
if os.time() - m.t < 1 then
|
|
if mob
|
|
then love.keyboard.setTextInput(
|
|
not love.keyboard.hasTextInput(),
|
|
0, con.th + con.oy,
|
|
con.w * con.cw, con.ch)
|
|
end
|
|
con.down()
|
|
end
|
|
end
|
|
|
|
if m.b == 1
|
|
then con.move(m.my) end
|
|
end
|
|
|
|
function love.wheelmoved(x, y)
|
|
con.move(y * con.ch)
|
|
end
|
|
|
|
end
|