mirror of
https://gitea.com/SweetSea-ButImNotSweet/tromi_mobile.git
synced 2025-01-08 17:33:09 +08:00
Not showing virtual control on computer
This commit is contained in:
@@ -98,8 +98,9 @@ function control_type.button:getDistance(x,y)
|
||||
end
|
||||
|
||||
local touches={}
|
||||
local global_toggle=false
|
||||
VCTRL={}
|
||||
VCTRL.focus=nil -- Focusing buttons
|
||||
-- VCTRL.focus=nil -- Focusing buttons
|
||||
|
||||
---@param ... table
|
||||
---@class data
|
||||
@@ -120,6 +121,7 @@ function VCTRL.new(...)
|
||||
end
|
||||
|
||||
function VCTRL.press(x,y,id)
|
||||
if not global_toggle then return end
|
||||
local obj,closestDist=false,1e99
|
||||
for i=1,#VCTRL do
|
||||
local w=VCTRL[i]
|
||||
@@ -133,12 +135,13 @@ 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
|
||||
|
||||
function VCTRL.release(id)
|
||||
if not global_toggle then return end
|
||||
if touches[id] then
|
||||
touches[id]:release()
|
||||
return true
|
||||
@@ -147,15 +150,23 @@ function VCTRL.release(id)
|
||||
end
|
||||
|
||||
function VCTRL.drag(dx,dy,id)
|
||||
if not global_toggle then return end
|
||||
if touches[id] then
|
||||
touches[id]:drag(dx,dy)
|
||||
end
|
||||
end
|
||||
|
||||
function VCTRL.draw(forceLight)
|
||||
if not global_toggle then return end
|
||||
for i=1,#VCTRL do
|
||||
if VCTRL[i].show then
|
||||
VCTRL[i]:draw(forceLight)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
---@param toggle boolean|false
|
||||
---Enabling virtual control or not
|
||||
function VCTRL.toggle(toggle)
|
||||
global_toggle=toggle
|
||||
end
|
||||
Reference in New Issue
Block a user