新增两个保存虚拟按键布局的按钮

This commit is contained in:
MrZ626
2021-05-10 01:44:51 +08:00
parent 4cc77e0068
commit 4bf8eb4c1a
7 changed files with 66 additions and 9 deletions

View File

@@ -62,6 +62,7 @@ return{
exportSuccess="Exported successfully",
importSuccess="Imported successfully",
dataCorrupted="Data corrupted",
noFile="File not found",
VKTchW="Touch Weight",
VKOrgW="Origin Weight",
@@ -377,6 +378,10 @@ return{
default="Default",
snap="Snap",
option="Options",
save1="Save1",
load1="Load1",
save2="Save2",
load2="Load2",
size="Size",
},
setting_touchSwitch={

View File

@@ -63,6 +63,7 @@ return{
exportSuccess="Exporté avec succès",
importSuccess="Importé avec succès",
dataCorrupted="Données corrompues",
-- noFile="File not found",
VKTchW="Poids du toucher",
VKOrgW="Poids d'origine",
@@ -348,6 +349,10 @@ return{
default="Par défaut",
snap="Snap",
option="Options",
-- save1="Save1",
-- load1="Load1",
-- save2="Save2",
-- load2="Load2",
size="Taille",
},
setting_touchSwitch={

View File

@@ -63,6 +63,7 @@ return{
exportSuccess="Exportado com sucesso",
importSuccess="Importado com sucesso",
dataCorrupted="Data corrompida",
-- noFile="File not found",
VKTchW="Peso de toque",
VKOrgW="Peso da origem",
@@ -378,6 +379,10 @@ return{
default="Default",
snap="Encaixo",
option="Opção",
-- save1="Save1",
-- load1="Load1",
-- save2="Save2",
-- load2="Load2",
size="Tamanho",
},
setting_touchSwitch={

View File

@@ -63,6 +63,7 @@ return{
exportSuccess="Exportado con éxito",
importSuccess="Importado con éxito",
dataCorrupted="Los datos están corruptos.",
-- noFile="File not found",
VKTchW="Sens. al tacto",
VKOrgW="Sens. al origen",
@@ -351,6 +352,10 @@ return{
default="Por Defecto",
snap="Snap",
option="Opciones",
-- save1="Save1",
-- load1="Load1",
-- save2="Save2",
-- load2="Load2",
size="Tamaño",
},
setting_touchSwitch={

View File

@@ -47,6 +47,8 @@ return{
exportSuccess="~Out~",
importSuccess="~In~",
dataCorrupted="XXXXX",
-- noFile="File not found",
VKTchW="Tch↓",
VKOrgW="Org↓",
VKCurW="Cur↓",
@@ -231,6 +233,10 @@ return{
default="$0",
snap="_ _",
option="_?",
save1=">1",
load1="1>",
save2=">2",
load2="2>",
size="←→",
},
setting_touchSwitch={

View File

@@ -62,6 +62,7 @@ return{
exportSuccess="导出成功",
importSuccess="导入成功",
dataCorrupted="数据损坏",
noFile="找不到文件",
VKTchW="触摸点权重",
VKOrgW="原始点权重",
@@ -376,6 +377,10 @@ return{
default="默认组合",
snap="吸附",
option="选项",
save1="保存1",
load1="读取1",
save2="保存2",
load2="读取2",
size="大小",
},
setting_touchSwitch={

View File

@@ -1,7 +1,6 @@
local gc=love.graphics
local ms=love.mouse
local gc,ms=love.graphics,love.mouse
local int,sin=math.floor,math.sin
local VK_org=VK_org
local scene={}
@@ -9,6 +8,29 @@ local defaultSetSelect
local snapUnit=1
local selected--Button selected
local function save1()
FILE.save(VK_org,"conf/vkSave1")
end
local function load1()
local D=FILE.load("conf/vkSave1")
if D then
TABLE.update(D,VK_org)
else
LOG.print(text.noFile,'message')
end
end
local function save2()
FILE.save(VK_org,"conf/vkSave2")
end
local function load2()
local D=FILE.load("conf/vkSave2")
if D then
TABLE.update(D,VK_org)
else
LOG.print(text.noFile,'message')
end
end
function scene.sceneInit()
BG.set('rainbow')
defaultSetSelect=1
@@ -150,7 +172,7 @@ local virtualkeySet={
},--PC key feedback(top&in a row)
}
scene.widgetList={
WIDGET.newButton{name="default",x=520,y=90,w=200,h=80,font=35,
WIDGET.newButton{name="default",x=530,y=90,w=200,h=80,font=35,
code=function()
local D=virtualkeySet[defaultSetSelect]
for i=1,#VK_org do
@@ -166,17 +188,21 @@ scene.widgetList={
B.x,B.y,B.r=T[2],T[3],T[4]
end
end
LOG.print("[ "..defaultSetSelect.." ]")
LOG.print(("[ %d ]"):format(defaultSetSelect))
defaultSetSelect=defaultSetSelect%5+1
selected=false
end},
WIDGET.newSelector{name="snap", x=760,y=90,w=200,h=80,color='Y',list={1,10,20,40,60,80},disp=function()return snapUnit end,code=function(i)snapUnit=i end},
WIDGET.newButton{name="option", x=520,y=190,w=200,h=80,font=40,
WIDGET.newSelector{name="snap", x=750,y=90,w=200,h=80,color='Y',list={1,10,20,40,60,80},disp=function()return snapUnit end,code=function(i)snapUnit=i end},
WIDGET.newButton{name="option", x=530,y=190,w=200,h=80,font=40,
code=function()
SCN.go('setting_touchSwitch')
end},
WIDGET.newButton{name="back", x=760,y=190,w=200,h=80,font=35,code=backScene},
WIDGET.newSlider{name="size", x=450,y=270,w=460,unit=19,font=40,show="vkSize",
WIDGET.newButton{name="back", x=750,y=190,w=200,h=70,font=35,code=backScene},
WIDGET.newKey{name="save1", x=475,y=290,w=90,h=70,code=save1},
WIDGET.newKey{name="load1", x=585,y=290,w=90,h=70,code=load1},
WIDGET.newKey{name="save2", x=695,y=290,w=90,h=70,code=save2},
WIDGET.newKey{name="load2", x=805,y=290,w=90,h=70,code=load2},
WIDGET.newSlider{name="size", x=440,y=370,w=460,unit=19,font=40,show="vkSize",
disp=function()
return VK_org[selected].r/10-1
end,