mirror of
https://gitea.com/SweetSea-ButImNotSweet/tromi_mobile.git
synced 2025-01-08 17:33:09 +08:00
Add `SCENE:onInputMove`
This commit is contained in:
@@ -159,7 +159,7 @@ function VCTRL.press(x,y,id)
|
||||
if obj then
|
||||
touches[id]=obj
|
||||
obj:press(x,y,id)
|
||||
-- VCTRL.focus=obj
|
||||
VCTRL.focus=obj
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
6
main.lua
6
main.lua
@@ -136,6 +136,12 @@ function love.touchpressed(id,x,y)
|
||||
SCENE:onInputPress{type = "touch", x = x, y = y, dx = 0, dy = 0, id = id}
|
||||
end
|
||||
end
|
||||
function love.touchdragged(id,x,y,dx,dy)
|
||||
local x,y=GLOBAL_TRANSFORM:inverseTransformPoint(x,y)
|
||||
if not VCTRL.press(x,y,id) then
|
||||
SCENE:onInputMove{type = "touch", x = x, y = y, dx = dx, dy = dy, id = id}
|
||||
end
|
||||
end
|
||||
function love.touchreleased(id,x,y)
|
||||
local x,y=GLOBAL_TRANSFORM:inverseTransformPoint(x,y)
|
||||
if not VCTRL.release(id) then
|
||||
|
||||
12
scene.lua
12
scene.lua
@@ -5,8 +5,16 @@ SCENE = Object:extend()
|
||||
function SCENE:new() end
|
||||
function SCENE:update() end
|
||||
function SCENE:render() end
|
||||
function SCENE:onInputPress() end
|
||||
function SCENE:onInputRelease() end
|
||||
|
||||
-- e in 3 below functions will contain:
|
||||
-- key - input, key, scancode
|
||||
-- joystick - input, button, name
|
||||
-- touch - x, y, dx, dy, id
|
||||
-- virtual - key
|
||||
|
||||
function SCENE:onInputPress(e) end
|
||||
function SCENE:onInputMove(e) end
|
||||
function SCENE:onInputRelease(e) end
|
||||
|
||||
ExitScene = require "scene.exit"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user