V1 update (#1)

This commit is contained in:
Nguyễn Quốc Hưng
2024-06-06 16:01:24 +07:00
committed by Squishy (C6H12O6+NaCl+H2O)
parent 3343d8711b
commit 1d6643448e
30 changed files with 1000 additions and 228 deletions

View File

@@ -64,7 +64,7 @@ function control_type.button:new(data)
r=data.r or 80, -- size
shape=data.shape or 'circle',
key=data.key or 'X',
iconSize=data.iconSize or 80,
iconSize=data.iconSize or 60,
alpha=data.alpha or 0.75,
quad=virtual_quad[data.key]
},self)
@@ -90,7 +90,7 @@ end
function control_type.button:press(_,_,id)
self.pressed=true
self.lastPressTime=love.timer.getTime()
self.pressing=id
self.pressingID=id
-- love.keypressed(self.key, love.keyboard.getScancodeFromKey(self.key))
SCENE:onInputPress{input=self.key,type="virtual"}
end
@@ -148,6 +148,7 @@ local touches={}
local global_toggle=false
VCTRL={}
VCTRL.focus=nil -- Focusing buttons
VCTRL.hasChanged = false
---@class VCTRL.data
---@field type 'button'
@@ -231,6 +232,13 @@ function VCTRL.draw(forceAlpha)
end
end
function VCTRL.reset()
for _, w in ipairs(VCTRL) do
if w.pressingID then touches[w.pressingID] = nil end
w:reset()
end
end
function VCTRL.exportAll()
local t = {}
for o, k in ipairs(VCTRL) do t[o] = k:export() end