mirror of
https://gitea.com/SweetSea-ButImNotSweet/tromi_mobile.git
synced 2025-01-08 17:33:09 +08:00
update virtual control texture
This commit is contained in:
@@ -20,11 +20,15 @@ local empty_quad
|
||||
local virtual_quad=setmetatable((function()
|
||||
local t={}
|
||||
local w=180
|
||||
empty_quad=gc_newQuad(0,0,1,1,4*w,3*w)
|
||||
empty_quad=gc_newQuad(0,0,1,1,5*w,7*w)
|
||||
for i,name in next,{
|
||||
'left','right','up','down',
|
||||
'rotate_right','rotate_left','rotate_right2','rotate_left2',
|
||||
'menu_deicde','','menu_back'
|
||||
'left','right','up','down','',
|
||||
'rotate_right','rotate_left','','','',
|
||||
'menu_deicde','','menu_back','','',
|
||||
'','','','','',
|
||||
'','','back','','',
|
||||
'','','','','',
|
||||
'','','','','select',
|
||||
} do if #name>0 then t[name]=gc_newQuad((i-1)%4*w,math.floor((i-1)/4)*w,w,w,4*w,3*w) end end -- 4x2 is the size of entire texture
|
||||
return t
|
||||
end)(),{
|
||||
@@ -51,6 +55,10 @@ function control_type.button:new(data)
|
||||
quad=virtual_quad[data.icon]
|
||||
},self)
|
||||
end
|
||||
function control_type.button:reset()
|
||||
self.pressed=false
|
||||
self.lastPressTime=-1e99
|
||||
end
|
||||
function control_type.button:press()
|
||||
self.pressed=true
|
||||
self.lastPressTime=love.timer.getTime()
|
||||
@@ -102,6 +110,12 @@ local global_toggle=false
|
||||
VCTRL={}
|
||||
-- VCTRL.focus=nil -- Focusing buttons
|
||||
|
||||
---@param toggle boolean|false
|
||||
---Enabling virtual control or not
|
||||
function VCTRL.toggle(toggle)
|
||||
global_toggle=toggle
|
||||
end
|
||||
|
||||
---@param ... table
|
||||
---@class data
|
||||
---@field type string
|
||||
@@ -163,10 +177,4 @@ function VCTRL.draw(forceLight)
|
||||
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