Add VCTRL.export (for saving feature)

This commit is contained in:
Squishy (C6H12O6+NaCl+H2O)
2024-05-17 20:17:37 +07:00
parent bc7cc6c193
commit d8b8c5bf76

View File

@@ -15,6 +15,7 @@ local function mDrawQ(obj,quad,x,y,a,k)
love.graphics.draw(obj,quad,x,y,a,k,nil,w*.5,h*.5)
end
ShowLoadingText('virtual key skin')
local empty_quad
-- A table containing quads used to draw icons for virtual control system.
local virtual_quad=setmetatable((function()
@@ -56,6 +57,19 @@ function control_type.button:new(data)
quad=virtual_quad[data.key]
},self)
end
function control_type.button:export()
return {
show = self.show,
x = self.x,
y = self.y,
r = self.r,
shape = self.shape,
key = self.key,
iconSize = self.iconSize,
alpha = self.alpha,
quad = self.quad
}
end
function control_type.button:reset()
self.pressed=false
self.lastPressTime=-1e99
@@ -194,4 +208,6 @@ function VCTRL.draw(forceLight)
VCTRL[i]:draw(forceLight)
end
end
end
end
function VCTRL.export(K) return K:export() end