Skip to content

Commit

Permalink
piano小程序添加钢琴键盘布局
Browse files Browse the repository at this point in the history
整理代码
  • Loading branch information
MrZ626 committed Nov 20, 2024
1 parent 48a83a0 commit 382ee0d
Showing 1 changed file with 92 additions and 31 deletions.
123 changes: 92 additions & 31 deletions assets/scene_app/piano.lua
Original file line number Diff line number Diff line change
Expand Up @@ -88,37 +88,6 @@ local layoutList={
['z']=24,['x']=26,['c']=28,['v']=29,['b']=31,['n']=33,['m']=35,[',']=36,['.']=38,['/']=40,
},
},
{
name="Melodic Phone Keypad (on C)",
pos_x=-70,
pos_y=-25,
size=10,
font=60,
-- fillC='M',
lineC='LD',
-- actvC='M',
textC='D',
keyLayout={
{x=050,y=15,w=8,h=8,key='kp7', fillC='LS',actvC='R',}, -- Line 4
{x=060,y=15,w=8,h=8,key='kp8', fillC='LS',actvC='R',},
{x=070,y=15,w=8,h=8,key='kp9', fillC='LS',actvC='R',},

{x=050,y=25,w=8,h=8,key='kp4', fillC='LS',actvC='R',},
{x=060,y=25,w=8,h=8,key='kp5', fillC='LS',actvC='R',},
{x=070,y=25,w=8,h=8,key='kp6', fillC='LS',actvC='R',},

{x=050,y=35,w=8,h=8,key='kp1', fillC='LS',actvC='R',},
{x=060,y=35,w=8,h=8,key='kp2', fillC='LS',actvC='R',},
{x=070,y=35,w=8,h=8,key='kp3', fillC='LS',actvC='R',},

{x=050,y=45,w=8,h=8,key='kp0', fillC='LS',actvC='R',},
{x=060,y=45,w=8,h=8,key='kp.', fillC='LS',actvC='R',},
{x=070,y=45,w=8,h=8,key='kpenter', fillC='LS',actvC='R',},
},
keyMap={
['kp7']=60,['kp8']=62,['kp9']=64,['kp4']=65,['kp5']=67,['kp6']=69,['kp1']=71,['kp2']=72,['kp3']=74,['kp0']=76,['kp.']=77,['kpenter']=79,
},
},
{
name="Simple (on C)",
pos_x=-71.5,
Expand Down Expand Up @@ -187,6 +156,98 @@ local layoutList={
['z']=24,['x']=26,['c']=28,['v']=29,['b']=31,['n']=33,['m']=35,[',']=36,['.']=38,['/']=40,
},
},
{
name="Piano",
pos_x=-96/2-1,
pos_y=12,
size=16,
font=30 ,
fillC='L',
lineC='LD',
actvC='LS',
textC='lD',
keyLayout={
{x=.5*4,y=0,w=2,h=9},
{x=01*4,y=0,w=4,h=9,show='',key='z'},
{x=02*4,y=0,w=4,h=9,show='',key='x'},
{x=03*4,y=0,w=4,h=9,show='',key='c'},
{x=04*4,y=0,w=4,h=9,show='',key='v'},
{x=05*4,y=0,w=4,h=9,show='',key='b'},
{x=06*4,y=0,w=4,h=9,show='',key='n'},
{x=07*4,y=0,w=4,h=9,show='',key='m'},
{x=08*4,y=0,w=4,h=9,show='',key=','},
{x=09*4,y=0,w=4,h=9,show='',key='.'},
{x=10*4,y=0,w=4,h=9,show='',key='/'},
{x=11*4,y=0,w=4,h=9,show='',key='q'},
{x=12*4,y=0,w=4,h=9,show='',key='w'},
{x=13*4,y=0,w=4,h=9,show='',key='e'},
{x=14*4,y=0,w=4,h=9,show='',key='r'},
{x=15*4,y=0,w=4,h=9,show='',key='t'},
{x=16*4,y=0,w=4,h=9,show='',key='y'},
{x=17*4,y=0,w=4,h=9,show='',key='u'},
{x=18*4,y=0,w=4,h=9,show='',key='i'},
{x=19*4,y=0,w=4,h=9,show='',key='o'},
{x=20*4,y=0,w=4,h=9,show='',key='p'},
{x=21*4,y=0,w=4,h=9,show='',key='['},
{x=22*4,y=0,w=4,h=9,show='',key=']'},
{x=23*4,y=0,w=4,h=9,show='',key='\\'},
{x=2.7+00*4 -.4*1.5,y=0,w=2.6,h=6,show='',key='a',fillC='lD'},
{x=2.7+01*4 +.0*1.5,y=0,w=2.6,h=6,show='',key='s',fillC='lD'},
{x=2.7+02*4 +.4*1.5,y=0,w=2.6,h=6,show='',key='d',fillC='lD'},
{x=2.7+04*4 -.3*1.5,y=0,w=2.6,h=6,show='',key='g',fillC='lD'},
{x=2.7+05*4 +.3*1.5,y=0,w=2.6,h=6,show='',key='h',fillC='lD'},
{x=2.7+07*4 -.4*1.5,y=0,w=2.6,h=6,show='',key='k',fillC='lD'},
{x=2.7+08*4 +.0*1.5,y=0,w=2.6,h=6,show='',key='l',fillC='lD'},
{x=2.7+09*4 +.4*1.5,y=0,w=2.6,h=6,show='',key=';',fillC='lD'},
{x=2.7+11*4 -.3*1.5,y=0,w=2.6,h=6,show='',key='2',fillC='lD'},
{x=2.7+12*4 +.3*1.5,y=0,w=2.6,h=6,show='',key='3',fillC='lD'},
{x=2.7+14*4 -.4*1.5,y=0,w=2.6,h=6,show='',key='5',fillC='lD'},
{x=2.7+15*4 +.0*1.5,y=0,w=2.6,h=6,show='',key='6',fillC='lD'},
{x=2.7+16*4 +.4*1.5,y=0,w=2.6,h=6,show='',key='7',fillC='lD'},
{x=2.7+18*4 -.3*1.5,y=0,w=2.6,h=6,show='',key='9',fillC='lD'},
{x=2.7+19*4 +.3*1.5,y=0,w=2.6,h=6,show='',key='0',fillC='lD'},
{x=2.7+21*4 -.4*1.5,y=0,w=2.6,h=6,show='',key='=',fillC='lD'},
{x=2.7+22*4 +.0*1.5,y=0,w=2.6,h=6,show='',key='backspace',fillC='lD',actvC='dL',textC='dL'},
{x=2.7+23*4 +.0*1.5,y=0,w=1.3,h=6,show='',fillC='lD',actvC='dL',textC='dL'},
},
keyMap={
['2']=37,['3']=39, ['5']=42,['6']=44,['7']=46, ['9']=49,['0']=51, ['=']=54,['backspace']=56,
['q']=36,['w']=38,['e']=40,['r']=41,['t']=43,['y']=45,['u']=47,['i']=48,['o']=50,['p']=52,['[']=53,[']']=55,['\\']=57,
['a']=18,['s']=20,['d']=22, ['g']=25,['h']=27, ['k']=30,['l']=32,[';']=34,
['z']=19,['x']=21,['c']=23,['v']=24,['b']=26,['n']=28,['m']=29,[',']=31,['.']=33,['/']=35,
},
},
{
name="Melodic Phone Keypad (on C)",
pos_x=-28/2,
pos_y=-38/2,
size=18,
font=100,
fillC='dL',
lineC='lD',
actvC='lR',
textC='D',
keyLayout={
{x=00,y=00,w=8,h=8,key='kp7'},
{x=10,y=00,w=8,h=8,key='kp8'},
{x=20,y=00,w=8,h=8,key='kp9'},
{x=00,y=10,w=8,h=8,key='kp4'},
{x=10,y=10,w=8,h=8,key='kp5'},
{x=20,y=10,w=8,h=8,key='kp6'},
{x=00,y=20,w=8,h=8,key='kp1'},
{x=10,y=20,w=8,h=8,key='kp2'},
{x=20,y=20,w=8,h=8,key='kp3'},
{x=00,y=30,w=8,h=8,key='kp0'},
{x=10,y=30,w=8,h=8,key='kp.'},
{x=20,y=30,w=8,h=8,key='kpenter'},
},
keyMap={
['kp7']=48,['kp8']=50,['kp9']=52,
['kp4']=53,['kp5']=55,['kp6']=57,
['kp1']=59,['kp2']=60,['kp3']=62,
['kp0']=64,['kp.']=65,['kpenter']=67,
},
},
}
local defaultKeyName={
['=']='+',['backspace']=CHAR.key.backspace,
Expand Down

0 comments on commit 382ee0d

Please sign in to comment.