diff --git a/VOICE/double_3.ogg b/VOICE/double_3.ogg index 5e289815..5e647be7 100644 Binary files a/VOICE/double_3.ogg and b/VOICE/double_3.ogg differ diff --git a/VOICE/nya_31.ogg b/VOICE/nya_31.ogg deleted file mode 100644 index 08b5519c..00000000 Binary files a/VOICE/nya_31.ogg and /dev/null differ diff --git a/VOICE/nya_21.ogg b/VOICE/nya_doubt_1.ogg similarity index 100% rename from VOICE/nya_21.ogg rename to VOICE/nya_doubt_1.ogg diff --git a/VOICE/nya_22.ogg b/VOICE/nya_doubt_2.ogg similarity index 100% rename from VOICE/nya_22.ogg rename to VOICE/nya_doubt_2.ogg diff --git a/VOICE/nya_11.ogg b/VOICE/nya_happy_1.ogg similarity index 100% rename from VOICE/nya_11.ogg rename to VOICE/nya_happy_1.ogg diff --git a/VOICE/nya_12.ogg b/VOICE/nya_happy_2.ogg similarity index 100% rename from VOICE/nya_12.ogg rename to VOICE/nya_happy_2.ogg diff --git a/VOICE/nya_13.ogg b/VOICE/nya_happy_3.ogg similarity index 100% rename from VOICE/nya_13.ogg rename to VOICE/nya_happy_3.ogg diff --git a/VOICE/nya_happy_4.ogg b/VOICE/nya_happy_4.ogg new file mode 100644 index 00000000..e1faf505 Binary files /dev/null and b/VOICE/nya_happy_4.ogg differ diff --git a/VOICE/nya_sad_1.ogg b/VOICE/nya_sad_1.ogg new file mode 100644 index 00000000..4270f18c Binary files /dev/null and b/VOICE/nya_sad_1.ogg differ diff --git a/class.lua b/class.lua index f54a7c46..890aeb2b 100644 --- a/class.lua +++ b/class.lua @@ -53,37 +53,29 @@ end function button:draw() local x,y,w,h=self.x,self.y,self.w,self.h local r,g,b=unpack(self.color) + gc.setColor(.2+r*.8,.2+g*.8,.2+b*.8,.7) + local sd=shader_glow + sd:send("X",x)sd:send("Y",y)sd:send("W",w)sd:send("H",h) + gc.setShader(sd) + gc.rectangle("fill",x,y,w,h) + gc.setShader() if self==widget_sel then - gc.setColor(r*.7,g*.7,b*.7) - gc.rectangle("fill",x,y,w,h) - x,y,w,h=x+w,y+h,-w,-h - else - gc.setColor(r*.9,g*.9,b*.9) - gc.rectangle("fill",x,y,w,h) - end - gc.setLineWidth(3) - gc.setColor(.4+r*.6,.4+g*.6,.4+b*.6) - gc.line(x,y+h,x,y,x+w,y) - gc.setColor(r*.6,g*.6,b*.6) - gc.line(x,y+h,x+w,y+h,x+w,y) - if self==widget_sel then - x,y,w,h=x+w,y+h,-w,-h + gc.setLineWidth(4) + gc.setColor(1,1,1,.8) + gc.rectangle("line",x+2,y+2,w-4,h-4) end local t=self.text if t then if type(t)=="function"then t=t()end setFont(self.font) local y0=y+h*.5-self.font*.7 - gc.setColor(1,1,1,.5) - if self==widget_sel then - gc.printf(t,x+2,y0+1,w,"center") - gc.setColor(r*.5,g*.5,b*.5) - gc.printf(t,x,y0,w,"center") - else - gc.printf(t,x,y0-1,w,"center") - gc.setColor(r*.6,g*.6,b*.6) - gc.printf(t,x-2,y0-2,w,"center") - end + gc.setColor(1,1,1,.3) + gc.printf(t,x-2,y0-2,w,"center") + gc.printf(t,x-2,y0+2,w,"center") + gc.printf(t,x+2,y0-2,w,"center") + gc.printf(t,x+2,y0+2,w,"center") + gc.setColor(r*.5,g*.5,b*.5) + gc.printf(t,x,y0,w,"center") end end function button:getInfo() @@ -116,17 +108,11 @@ function switch:draw() gc.setLineWidth(6) gc.line(x+5,y+25,x+18,y+38,x+45,y+11) end--checked - if self==widget_sel then - gc.setColor(1,1,1,.4) - else - gc.setColor(1,1,1,.2) - end + gc.setColor(1,1,1,self==widget_sel and .6 or .3) gc.rectangle("fill",x,y,50,50) - gc.setLineWidth(3) + gc.setLineWidth(4) gc.setColor(1,1,1) - gc.line(x,y+50,x,y,x+50,y) - gc.setColor(1,1,1,.7) - gc.line(x,y+50,x+50,y+50,x+50,y) + gc.rectangle("line",x,y,50,50) --frame local t=self.text if t then @@ -161,7 +147,7 @@ function slider:FX(pos) end function slider:draw() local x,y=self.x,self.y - gc.setColor(1,1,1,self==widget_sel and 1 or .5) + gc.setColor(1,1,1,self==widget_sel and .7 or .5) gc.setLineWidth(2) local x1,x2=x,x+self.w for p=0,self.unit do @@ -169,7 +155,7 @@ function slider:draw() gc.line(x,y+7,x,y-7) end --units - gc.setLineWidth(5) + gc.setLineWidth(4) gc.line(x1,y,x2,y) --axis local t=self.text @@ -179,14 +165,14 @@ function slider:draw() gc.printf(t,x-312,y-self.font*.7,300,"right") end --text - local x,y=x1+(x2-x1)*self.disp()/self.unit-8,y-15 + local x,y=x1+(x2-x1)*self.disp()/self.unit-9,y-16 gc.setColor(.8,.8,.8) - gc.rectangle("fill",x,y,17,30) - gc.setLineWidth(2) - gc.setColor(.5,.5,.5) - gc.line(x,y+30,x+17,y+30,x+17,y) - gc.setColor(1,1,1) - gc.line(x,y+30,x,y,x+17,y) + gc.rectangle("fill",x,y,19,32) + if self==widget_sel then + gc.setLineWidth(2) + gc.setColor(1,1,1) + gc.rectangle("line",x+1,y+1,18,30) + end --block end function slider:getInfo() diff --git a/conf.lua b/conf.lua index 390ff5e3..f0c3513f 100644 --- a/conf.lua +++ b/conf.lua @@ -1,13 +1,12 @@ -math.randomseed(os.time()) -gameVersion="Alpha V0.8.2+" +gameVersion="Alpha V0.8.3" function love.conf(t) t.identity="Techmino"--Save directory name t.version="11.1" t.console=X t.gammacorrect=X - t.appendidentity=X--If search files in source before save directory - t.accelerometerjoystick=X--If exposing accelerometer on iOS and Android as a Joystick - t.audio.mixwithsystem=true--Switch on to keep sysBGM + t.appendidentity=X--Search files in source before save directory + t.accelerometerjoystick=false--ios/android加速度计=摇杆 + t.audio.mixwithsystem=true local W=t.window W.title="Techmino "..gameVersion @@ -21,7 +20,7 @@ function love.conf(t) W.vsync=0--0→∞fps W.msaa=X--The number of samples to use with multi-sampled antialiasing (number) W.depth=X--Bits per sample in the depth buffer - W.stencil=1--The number of bits per sample in the stencil buffer + W.stencil=1--Bits per sample in the stencil buffer W.display=1--Monitor ID W.highdpi=X--Enable high-dpi mode for the window on a Retina display (boolean) W.x,W.y=nil diff --git a/font.ttf b/font.ttf index 1bee51f0..d97a0bee 100644 Binary files a/font.ttf and b/font.ttf differ diff --git a/image/miya/ch.png b/image/miya/ch.png index 3a25a7b7..ea2a8b2a 100644 Binary files a/image/miya/ch.png and b/image/miya/ch.png differ diff --git a/language/chi.lua b/language/chi.lua index 9b6dd45c..56aeea02 100644 --- a/language/chi.lua +++ b/language/chi.lua @@ -308,8 +308,8 @@ return{ }, setting_touch={ default="默认组合", - snap=function()return text.snapLevelName[snapLevel]end, - more="更多", + snap=function()return text.snapLevelName[sceneTemp.snap]end, + option="选项", back=BK, size="大小", }, diff --git a/language/chi_full.lua b/language/chi_full.lua index 7f0c8dc4..eae0750e 100644 --- a/language/chi_full.lua +++ b/language/chi_full.lua @@ -309,8 +309,8 @@ return{ }, setting_touch={ default="默认组合", - snap=function()return text.snapLevelName[snapLevel]end, - more="更多", + snap=function()return text.snapLevelName[sceneTemp.snap]end, + option="选项", back=BK, size="大小", }, diff --git a/language/eng.lua b/language/eng.lua index c6cc00bc..3387c344 100644 --- a/language/eng.lua +++ b/language/eng.lua @@ -307,8 +307,8 @@ Lib used: }, setting_touch={ default="Defaults", - snap=function()return text.snapLevelName[snapLevel]end, - more="More", + snap=function()return text.snapLevelName[sceneTemp.snap]end, + option="Option", back=BK, size="Size", }, diff --git a/list.lua b/list.lua index 5d7ba729..a0fb94bf 100644 --- a/list.lua +++ b/list.lua @@ -96,7 +96,10 @@ voiceName={ "mini","b2b","b3b","pc", "win","lose", "bye", - "nya","voc_nya", + "nya", + "happy", + "doubt", + "sad", "egg", } voiceList={ @@ -121,7 +124,9 @@ voiceList={ lose={"lose_1","lose_2","lose_3"}, bye={"bye_1","bye_2"}, nya={"nya_1","nya_2","nya_3","nya_4"}, - voc_nya={"nya_11","nya_12","nya_13","nya_21","nya_22"}, + happy={"nya_happy_1","nya_happy_2","nya_happy_3","nya_happy_4"}, + doubt={"nya_doubt_1","nya_doubt_2"}, + sad={"nya_sad_1"}, egg={"egg_1","egg_2"}, } @@ -239,26 +244,26 @@ local virtualkeySet={ {10,80, 320, 80},--restart },--Keyboard set { - {10,70, 50,27},--restart - {9, 130, 50,27},--func - {4, 190, 50,27},--rotLeft - {3, 250, 50,27},--rotRight - {5, 310, 50,27},--rotFlip - {1, 370, 50,27},--moveLeft - {2, 430, 50,27},--moveRight - {8, 490, 50,27},--hold - {7, 550, 50,27},--softDrop1 - {6, 610, 50,27},--hardDrop - {11,670, 50,27},--insLeft - {12,730, 50,27},--insRight - {13,790, 50,27},--insDown - {14,850, 50,27},--down1 - {15,910, 50,27},--down4 - {16,970, 50,27},--down10 - {17,1030, 50,27},--dropLeft - {18,1090, 50,27},--dropRight - {19,1150, 50,27},--addLeft - {20,1210, 50,27},--addRight + {10,70, 50,30},--restart + {9, 130, 50,30},--func + {4, 190, 50,30},--rotLeft + {3, 250, 50,30},--rotRight + {5, 310, 50,30},--rotFlip + {1, 370, 50,30},--moveLeft + {2, 430, 50,30},--moveRight + {8, 490, 50,30},--hold + {7, 550, 50,30},--softDrop1 + {6, 610, 50,30},--hardDrop + {11,670, 50,30},--insLeft + {12,730, 50,30},--insRight + {13,790, 50,30},--insDown + {14,850, 50,30},--down1 + {15,910, 50,30},--down4 + {16,970, 50,30},--down10 + {17,1030, 50,30},--dropLeft + {18,1090, 50,30},--dropRight + {19,1150, 50,30},--addLeft + {20,1210, 50,30},--addRight },--PC key feedback(top&in a row) } local customSet={ @@ -297,7 +302,7 @@ local function pressKey(k) end local function setPen(i) return function() - pen=i + sceneTemp.pen=i end end local function VKAdisp(n) @@ -357,8 +362,8 @@ Widget={ back= newButton(640, 630,230,90, C.white,40,scene.back), }, custom={ - up= newButton(1000, 220,100,100,C.white, 45,function()sel=(sel-2)%#customID+1 end), - down= newButton(1000, 460,100,100,C.white, 45,function()sel=sel%#customID+1 end), + up= newButton(1000, 220,100,100,C.white, 45,function()sceneTemp=(sceneTemp-2)%#customID+1 end), + down= newButton(1000, 460,100,100,C.white, 45,function()sceneTemp=sceneTemp%#customID+1 end), left= newButton(880, 340,100,100,C.white, 45,pressKey("left")), right= newButton(1120, 340,100,100,C.white, 45,pressKey("right")), start1= newButton(880, 580,220,70, C.lightGreen, 35,function()scene.push()loadGame(0,1)end), @@ -495,37 +500,38 @@ Widget={ }, setting_touch={ default=newButton(520,80,170,80,C.white,35,function() - local D=virtualkeySet[defaultSel] - for i=1,#VK_org do - VK_org[i].ava=false + local D=virtualkeySet[sceneTemp.default] + for i=1,#VK_org do + VK_org[i].ava=false + end + for n=1,#D do + local T=D[n] + if T[1]then + local B=VK_org[n] + B.ava=true + B.x,B.y,B.r=T[2],T[3],T[4] end - for n=1,#D do - local T=D[n] - if T[1]then - local B=VK_org[n] - B.ava=true - B.x,B.y,B.r=T[2],T[3],T[4] - end - end--Replace keys - defaultSel=defaultSel%5+1 + end--Replace keys + sceneTemp.default=sceneTemp.default%5+1 + sceneTemp.sel=nil end), snap= newButton(760,80,170,80,C.white,35,function() - snapLevel=snapLevel%6+1 + sceneTemp.snap=sceneTemp.snap%6+1 end), - more= newButton(520,180,170,80,C.white,40,function() + option= newButton(520,180,170,80,C.white,40,function() scene.push() scene.swapTo("setting_touchSwitch") end), back= newButton(760,180,170,80,C.white,40,scene.back), - size= newSlider(360,120,560,14,40,nil,function() - return VK_org[sel].r/10-1 + size= newSlider(450,265,460,14,40,nil,function() + return VK_org[sceneTemp.sel].r/10-1 end, function(v) - if sel then - VK_org[sel].r=10+v*10 + if sceneTemp.sel then + VK_org[sceneTemp.sel].r=10+v*10 end end, - function()return not sel end), + function()return not sceneTemp.sel end), }, setting_touchSwitch={ b1= newSwitch(280,80, 35,VKAdisp(1),VKAcode(1)), @@ -572,8 +578,8 @@ Widget={ back= newButton(640, 600,180,60,C.white,35,scene.back,nil,"qq"), }, history={ - prev= newButton(1155,170,180,180,C.white,65,pressKey("up"),function()return sel==1 end), - next= newButton(1155,400,180,180,C.white,65,pressKey("down"),function()return sel==#updateLog-22 end), + prev= newButton(1155,170,180,180,C.white,65,pressKey("up"),function()return sceneTemp==1 end), + next= newButton(1155,400,180,180,C.white,65,pressKey("down"),function()return sceneTemp==#updateLog-22 end), back= newButton(1155,600,180,90,C.white,35,scene.back), }, stat={ diff --git a/main.lua b/main.lua index 1d84413d..d30269be 100644 --- a/main.lua +++ b/main.lua @@ -1,7 +1,6 @@ --[[ -第一次搞这么大的工程~参考价值不是很大 -如果你有时间并且也热爱俄罗斯方块的话,来看代码或者帮助优化的话当然欢迎! -(顺便,无授权直接盗代码的先死个妈) +第一次搞这么大的工程,参考价值不是很大 +如果你有时间并且也热爱俄罗斯方块的话,来看代码或者帮助优化的话欢迎! ]] local love=love local ms,kb,tc=love.mouse,love.keyboard,love.touch @@ -71,6 +70,7 @@ require("light") local Tmr=require("timer") local Pnt=require("paint") require("player") +require("shader") --Modules ------------------------------------------------------------- local powerInfoCanvas,updatePowerInfo @@ -246,12 +246,12 @@ function wheelmoved.music(x,y) end function keyDown.music(key) if key=="down"then - sel=sel%#musicID+1 + sceneTemp=sceneTemp%#musicID+1 elseif key=="up"then - sel=(sel-2)%#musicID+1 + sceneTemp=(sceneTemp-2)%#musicID+1 elseif key=="return"or key=="space"then - if bgmPlaying~=musicID[sel]then - BGM(musicID[sel]) + if bgmPlaying~=musicID[sceneTemp]then + BGM(musicID[sceneTemp]) else BGM() end @@ -261,6 +261,7 @@ function keyDown.music(key) end function keyDown.custom(key) + local sel=sceneTemp if key=="left"then customSel[sel]=(customSel[sel]-2)%#customRange[customID[sel]]+1 if sel==12 then @@ -276,9 +277,9 @@ function keyDown.custom(key) BGM(customRange.bgm[customSel[sel]]) end elseif key=="down"then - sel=sel%#customID+1 + sceneTemp=sel%#customID+1 elseif key=="up"then - sel=(sel-2)%#customID+1 + sceneTemp=(sel-2)%#customID+1 elseif key=="d"then scene.push() scene.swapTo("draw") @@ -305,14 +306,16 @@ function mouseDown.draw(x,y,k) mouseMove.draw(x,y) end function mouseMove.draw(x,y,dx,dy) - sx,sy=int((x-200)/30)+1,20-int((y-60)/30) + local sx,sy=int((x-200)/30)+1,20-int((y-60)/30) if sx<1 or sx>10 then sx=nil end if sy<1 or sy>20 then sy=nil end + sceneTemp.x,sceneTemp.y=sx,sy if sx and sy and ms.isDown(1,2,3)then - preField[sy][sx]=ms.isDown(1)and pen or ms.isDown(2)and -1 or 0 + preField[sy][sx]=ms.isDown(1)and sceneTemp.pen or ms.isDown(2)and -1 or 0 end end function wheelmoved.draw(x,y) + local pen=sceneTemp.pen if y<0 then pen=pen+1 if pen==8 then pen=9 elseif pen==14 then pen=0 end @@ -320,16 +323,18 @@ function wheelmoved.draw(x,y) pen=pen-1 if pen==8 then pen=7 elseif pen==-1 then pen=13 end end + sceneTemp.pen=pen end function touchDown.draw(id,x,y) mouseMove.draw(x,y) end function touchMove.draw(id,x,y,dx,dy) - sx,sy=int((x-200)/30)+1,20-int((y-60)/30) + local sx,sy=int((x-200)/30)+1,20-int((y-60)/30) if sx<1 or sx>10 then sx=nil end if sy<1 or sy>20 then sy=nil end + sceneTemp.x,sceneTemp.y=sx,sy if sx and sy then - preField[sy][sx]=pen + preField[sy][sx]=sceneTemp.pen end end local penKey={ @@ -341,12 +346,13 @@ local penKey={ lshift=-1, lalt=-1, } function keyDown.draw(key) + local sx,sy,pen=sceneTemp.x,sceneTemp.y,sceneTemp.pen if key=="delete"then - if clearSureTime>15 then + if sceneTemp.sure>15 then for y=1,20 do for x=1,10 do preField[y][x]=0 end end - clearSureTime=0 + sceneTemp.sure=0 else - clearSureTime=50 + sceneTemp.sure=50 end elseif key=="up"or key=="down"or key=="left"or key=="right"then if not sx then sx=1 end @@ -368,30 +374,33 @@ function keyDown.draw(key) else pen=penKey[key]or pen end + sceneTemp.x,sceneTemp.y,sceneTemp.pen=sx,sy,pen end function mouseDown.setting_sound(x,y,k) - if Timer()-sel>5 and x>780 and x<980 and y>470 then - VOICE("egg") - sel=Timer() + if x>780 and x<980 and y>470 and sceneTemp.jump==0 then + sceneTemp.jump=10 + local t=Timer()-sceneTemp.last + if t>1 then + VOICE((t<1.5 or t>15)and"doubt"or rnd()<.8 and"happy"or"egg") + sceneTemp.last=Timer() + end end end function touchDown.setting_sound(id,x,y) - if Timer()-sel>5 and x>780 and x<980 and y>470 then - VOICE("egg") - sel=Timer() - end + mouseDown.setting_sound(x,y) end function keyDown.setting_key(key) + local s=sceneTemp if key=="escape"then - if keyboardSetting then - keyboardSetting=false + if s.kS then + s.kS=false SFX("error",.5) else scene.back() end - elseif keyboardSetting then + elseif s.kS then for l=1,8 do for y=1,20 do if setting.keyMap[l][y]==key then @@ -399,43 +408,44 @@ function keyDown.setting_key(key) end end end - setting.keyMap[curBoard][keyboardSet]=key + setting.keyMap[s.board][s.kb]=key SFX("reach",.5) - keyboardSetting=false + s.kS=false elseif key=="return"then - keyboardSetting=true + s.kS=true SFX("lock",.5) elseif key=="up"then - if keyboardSet>1 then - keyboardSet=keyboardSet-1 + if s.kb>1 then + s.kb=s.kb-1 SFX("move",.5) end elseif key=="down"then - if keyboardSet<20 then - keyboardSet=keyboardSet+1 + if s.kb<20 then + s.kb=s.kb+1 SFX("move",.5) end elseif key=="left"then - if curBoard>1 then - curBoard=curBoard-1 + if s.board>1 then + s.board=s.board-1 SFX("rotate",.5) end elseif key=="right"then - if curBoard<8 then - curBoard=curBoard+1 + if s.board<8 then + s.board=s.board+1 SFX("rotate",.5) end end end function gamepadDown.setting_key(key) + local s=sceneTemp if key=="back"then - if joystickSetting then - joystickSetting=false + if s.jS then + s.jS=false SFX("error",.5) else scene.back() end - elseif joystickSetting then + elseif s.jS then for l=9,16 do for y=1,20 do if setting.keyMap[l][y]==key then @@ -443,30 +453,30 @@ function gamepadDown.setting_key(key) end end end - setting.keyMap[8+curBoard][joystickSet]=key + setting.keyMap[8+s.board][s.js]=key SFX("reach",.5) - joystickSetting=false + s.jS=false elseif key=="start"then - joystickSetting=true + s.jS=true SFX("lock",.5) elseif key=="up"then - if joystickSet>1 then - joystickSet=joystickSet-1 + if s.js>1 then + s.js=s.js-1 SFX("move",.5) end elseif key=="down"then - if joystickSet<20 then - joystickSet=joystickSet+1 + if s.js<20 then + s.js=s.js+1 SFX("move",.5) end elseif key=="left"then - if curBoard>1 then - curBoard=curBoard-1 + if s.board>1 then + s.board=s.board-1 SFX("rotate",.5) end elseif key=="right"then - if curBoard<8 then - curBoard=curBoard+1 + if s.board<8 then + s.board=s.board+1 SFX("rotate",.5) end end @@ -474,37 +484,34 @@ end function mouseDown.setting_touch(x,y,k) if k==2 then scene.back()end - sel=onVK_org(x,y)or sel + sceneTemp.sel=onVK_org(x,y)or sceneTemp.sel end function mouseMove.setting_touch(x,y,dx,dy) - if sel and ms.isDown(1)and not widget_sel then - local B=VK_org[sel] + if sceneTemp.sel and ms.isDown(1)and not widget_sel then + local B=VK_org[sceneTemp.sel] B.x,B.y=B.x+dx,B.y+dy end end function mouseUp.setting_touch(x,y,k) - if sel then - local B=VK_org[sel] - local k=snapLevelValue[snapLevel] + if sceneTemp.sel then + local B=VK_org[sceneTemp.sel] + local k=snapLevelValue[sceneTemp.snap] B.x,B.y=int(B.x/k+.5)*k,int(B.y/k+.5)*k end end function touchDown.setting_touch(id,x,y) - sel=onVK_org(x,y)or sel + sceneTemp.sel=onVK_org(x,y)or sceneTemp.sel end function touchUp.setting_touch(id,x,y) - if sel then - x,y=xOy:inverseTransformPoint(x,y) - if sel then - local B=VK_org[sel] - local k=snapLevelValue[snapLevel] - B.x,B.y=int(B.x/k+.5)*k,int(B.y/k+.5)*k - end + if sceneTemp.sel then + local B=VK_org[sceneTemp.sel] + local k=snapLevelValue[sceneTemp.snap] + B.x,B.y=int(B.x/k+.5)*k,int(B.y/k+.5)*k end end function touchMove.setting_touch(id,x,y,dx,dy) - if sel and not widget_sel then - local B=VK_org[sel] + if sceneTemp.sel and not widget_sel then + local B=VK_org[sceneTemp.sel] B.x,B.y=B.x+dx,B.y+dy end end @@ -628,9 +635,9 @@ function wheelmoved.history(x,y) end function keyDown.history(key) if key=="up"then - sel=max(sel-5,1) + sceneTemp=max(sceneTemp-10,1) elseif key=="down"then - sel=min(sel+5,#updateLog-22) + sceneTemp=min(sceneTemp+10,#updateLog-22) elseif key=="escape"then scene.back() end @@ -1100,6 +1107,9 @@ function love.run() gc.present() end end + if Timer()-lastFrame<.058 then + T.sleep(.01) + end while Timer()-lastFrame<.0158 do T.sleep(.001) end diff --git a/paint.lua b/paint.lua index e1d1a2ea..5fc4d0fd 100644 --- a/paint.lua +++ b/paint.lua @@ -115,7 +115,7 @@ local function VirtualkeyPreview() for i=1,#VK_org do local B=VK_org[i] if B.ava then - local c=sel==i and .6 or 1 + local c=sceneTemp.sel==i and .6 or 1 gc.setColor(c,1,c,setting.VKAlpha*.1) gc.setLineWidth(B.r*.07) gc.circle("line",B.x,B.y,B.r) @@ -245,7 +245,7 @@ end function Pnt.intro() gc.stencil(stencil_miniTitle,"replace",1) gc.setStencilTest("equal",1) - gc.setColor(1,1,1,min(count,80)*.005) + gc.setColor(1,1,1,min(sceneTemp,80)*.005) gc.push("transform") gc.translate(250,150) gc.scale(30) @@ -254,7 +254,7 @@ function Pnt.intro() gc.setColor(1,1,1,.06) for i=41,5,-2 do gc.setLineWidth(i) - gc.line(200+(count-80)*25,130,(count-80)*25,590) + gc.line(200+(sceneTemp-80)*25,130,(sceneTemp-80)*25,590) end gc.setStencilTest() end @@ -295,7 +295,7 @@ function Pnt.mode() end function Pnt.music() gc.setColor(1,1,1,.3+sin(Timer()*5)*.2) - gc.rectangle("fill",45,98+30*sel,250,30) + gc.rectangle("fill",45,98+30*sceneTemp,250,30) gc.setColor(.8,.8,.8) gc.draw(drawableText.musicRoom,20,20) gc.setColor(1,1,1) @@ -319,7 +319,7 @@ function Pnt.music() end function Pnt.custom() gc.setColor(1,1,1,.3+sin(Timer()*8)*.2) - gc.rectangle("fill",25,95+40*sel,480,40) + gc.rectangle("fill",25,95+40*sceneTemp,480,40) gc.setColor(.8,.8,.8)gc.draw(drawableText.custom,20,20) gc.setColor(1,1,1)gc.draw(drawableText.custom,22,23) setFont(35) @@ -335,6 +335,7 @@ function Pnt.custom() end end function Pnt.draw() + local sx,sy=sceneTemp.x,sceneTemp.y gc.translate(200,60) gc.setColor(1,1,1,.2) gc.setLineWidth(1) @@ -358,10 +359,11 @@ function Pnt.draw() gc.rectangle("line",30*sx-30,600-30*sy,30,30) end gc.translate(-200,-60) - if clearSureTime>0 then - gc.setColor(1,1,1,clearSureTime*.02) + if sceneTemp.sure>0 then + gc.setColor(1,1,1,sceneTemp.sure*.02) gc.draw(drawableText.question,660,11) end + local pen=sceneTemp.pen if pen>0 then gc.setLineWidth(13) gc.setColor(blockColor[pen]) @@ -480,7 +482,8 @@ function Pnt.setting_sound() gc.setColor(1,1,1,.8) mDraw(drawableText.setting_sound,640,15) local t=Timer() - local x,y=790,370+10*sin(t*.4) + local _=sceneTemp.jump + local x,y=800,340+10*sin(t*.5)+(_-10)*_*.3 gc.translate(x,y) gc.draw(miya_ch,0,0) gc.setColor(1,1,1,.7) @@ -491,17 +494,18 @@ function Pnt.setting_sound() gc.translate(-x,-y) end function Pnt.setting_key() + local s=sceneTemp local a=.3+sin(Timer()*15)*.1 - if keyboardSetting then gc.setColor(1,.3,.3,a)else gc.setColor(1,.7,.7,a)end + if s.kS then gc.setColor(1,.3,.3,a)else gc.setColor(1,.7,.7,a)end gc.rectangle("fill", - keyboardSet<11 and 240 or 840, - 45*keyboardSet+20-450*int(keyboardSet/11), + s.kb<11 and 240 or 840, + 45*s.kb+20-450*int(s.kb/11), 200,45 ) - if joystickSetting then gc.setColor(.3,.3,.1,a)else gc.setColor(.7,.7,1,a)end + if s.jS then gc.setColor(.3,.3,.1,a)else gc.setColor(.7,.7,1,a)end gc.rectangle("fill", - joystickSet<11 and 440 or 1040, - 45*joystickSet+20-450*int(joystickSet/11), + s.js<11 and 440 or 1040, + 45*s.js+20-450*int(s.js/11), 200,45 ) --Selection rect @@ -515,15 +519,16 @@ function Pnt.setting_key() gc.setColor(1,1,1) setFont(26) + local board=s.board for N=1,20 do if N<11 then gc.printf(text.actName[N],47,45*N+22,180,"right") - mStr(setting.keyMap[curBoard][N],340,45*N+22) - mStr(setting.keyMap[curBoard+8][N],540,45*N+22) + mStr(setting.keyMap[board][N],340,45*N+22) + mStr(setting.keyMap[board+8][N],540,45*N+22) else gc.printf(text.actName[N],647,45*N-428,180,"right") - mStr(setting.keyMap[curBoard][N],940,45*N-428) - mStr(setting.keyMap[curBoard+8][N],1040,45*N-428) + mStr(setting.keyMap[board][N],940,45*N-428) + mStr(setting.keyMap[board+8][N],1040,45*N-428) end end gc.setLineWidth(2) @@ -535,8 +540,8 @@ function Pnt.setting_key() end setFont(35) gc.print("Player:",170,590) - gc.print(int(curBoard*.5+.5),300,590) - gc.print(curBoard.."/8",580,590) + gc.print(int(board*.5+.5),300,590) + gc.print(board.."/8",580,590) gc.draw(drawableText.ctrlSetHelp,50,650) end function Pnt.setting_touch() @@ -544,7 +549,7 @@ function Pnt.setting_touch() gc.setLineWidth(7)gc.rectangle("line",340,15,600,690) gc.setLineWidth(3)gc.rectangle("line",490,85,300,600) VirtualkeyPreview() - local d=snapLevelValue[snapLevel] + local d=snapLevelValue[sceneTemp.snap] if d>=10 then gc.setLineWidth(3) gc.setColor(1,1,1,sin(Timer()*4)*.1+.1) @@ -598,8 +603,8 @@ function Pnt.history() gc.setLineWidth(4) gc.rectangle("line",30,45,1000,632) setFont(20) - for i=0,min(22,#updateLog-sel)do - gc.print(updateLog[sel+i],40,50+27*(i)) + for i=0,min(22,#updateLog-sceneTemp)do + gc.print(updateLog[sceneTemp+i],40,50+27*(i)) end end return Pnt \ No newline at end of file diff --git a/scene.lua b/scene.lua index 71faa397..af006321 100644 --- a/scene.lua +++ b/scene.lua @@ -21,7 +21,7 @@ local sceneInit={ } end, intro=function() - count=0 + sceneTemp=0--animation timer BGM("blank") end, main=function() @@ -37,12 +37,12 @@ local sceneInit={ if bgmPlaying then for i=1,#musicID do if musicID[i]==bgmPlaying then - sel=i + sceneTemp=i--music select return end end else - sel=1 + sceneTemp=1 end end, mode=function() @@ -51,15 +51,14 @@ local sceneInit={ destroyPlayers() end, custom=function() - sel=sel or 1 + sceneTemp=1--option select destroyPlayers() curBG=customRange.bg[customSel[12]] BGM(customRange.bgm[customSel[13]]) end, draw=function() curBG="none" - clearSureTime=0 - pen,sx,sy=1,1,1 + sceneTemp={sure=0,pen=1,x=1,y=1} end, play=function() love.keyboard.setKeyRepeat(false) @@ -82,21 +81,23 @@ local sceneInit={ curBG="none" end, setting_sound=function() - sel=0--last sound time + sceneTemp={last=0,jump=0}--last sound time,animation count(10→0) curBG="none" end, setting_key=function() - curBoard=1 - keyboardSet=1 - joystickSet=1 - keyboardSetting=false - joystickSetting=false + sceneTemp={ + board=1, + kb=1,js=1, + kS=false,jS=false, + } end, setting_touch=function() curBG="game2" - defaultSel=1 - sel=nil - snapLevel=1 + sceneTemp={ + default=1, + snap=1, + sel=nil, + } end, setting_touchSwitch=function() curBG="matrix" @@ -107,7 +108,7 @@ local sceneInit={ history=function() updateLog=require"updateLog" curBG="lightGrey" - sel=1 + sceneTemp=1--scroll pos end, quit=function() love.timer.sleep(.3) diff --git a/shader.lua b/shader.lua new file mode 100644 index 00000000..32f0f156 --- /dev/null +++ b/shader.lua @@ -0,0 +1,2 @@ +gc=love.graphics +shader_glow=gc.newShader("shader/glow.cs") \ No newline at end of file diff --git a/shader/glow.cs b/shader/glow.cs new file mode 100644 index 00000000..5c5d8627 --- /dev/null +++ b/shader/glow.cs @@ -0,0 +1,5 @@ +extern float X;extern float Y;extern float W;extern float H; +vec4 effect(vec4 C,Image Tx,vec2 Tcd,vec2 Pcd){ + C[3]=min((Pcd.x-X)/W*.3+(Pcd.y-Y)/H*.1,.3)+.5; + return C; +} \ No newline at end of file diff --git a/shadowMapShader.cs b/shadowMapShader.cs index f470c385..2214c7d0 100644 --- a/shadowMapShader.cs +++ b/shadowMapShader.cs @@ -12,5 +12,5 @@ vec4 effect(vec4 color,Image texture,vec2 texture_coords,vec2 screen_coords){ vec4 data=Texel(texture,(vec2(-r*sin(theta),-r*cos(theta))*.5+.5));//vec2()..是遮光物采样的coord if(data.a>.1)return vec4(vec3(y/yresolution),1.);//碰撞检测,像素透明度>.1即透光 } - return vec4(vec3(1),1.);//返回最远距离1 + return vec4(1,1,1,1);//返回最远距离1 } \ No newline at end of file diff --git a/timer.lua b/timer.lua index eaa20422..55e0af8d 100644 --- a/timer.lua +++ b/timer.lua @@ -47,14 +47,14 @@ function Tmr.load() end end function Tmr.intro() - count=count+1 - if count==200 then count=80 end + sceneTemp=sceneTemp+1 + if sceneTemp==200 then sceneTemp=80 end end function Tmr.main(dt) players[1]:update(dt) end function Tmr.draw() - if clearSureTime>0 then clearSureTime=clearSureTime-1 end + if sceneTemp.sure>0 then sceneTemp.sure=sceneTemp.sure-1 end end function Tmr.play(dt) frame=frame+1 @@ -140,4 +140,10 @@ function Tmr.pause(dt) pauseTimer=pauseTimer+1 end end +function Tmr.setting_sound() + local t=sceneTemp.jump + if t>0 then + sceneTemp.jump=t-1 + end +end return Tmr \ No newline at end of file diff --git a/updateLog.lua b/updateLog.lua index a40f2c47..a75a70c2 100644 --- a/updateLog.lua +++ b/updateLog.lua @@ -9,11 +9,12 @@ Patron(rmb10+): ?[D*a] Future outlook: Normal: + timing mode powerinfo switch splashing block ajustable next count - new mode system custom block color/direction + new mode system combo mode bigbang mode TTT mode @@ -27,9 +28,12 @@ Future outlook: infinite 1v1 square mode more FXs & 3d features & animations +0.8.3: + new widget appearence + cuter miya 0.8.2+: GUI adjusted - added a cute cat + miya figure added 0.8.2: new widget appearence GUI adjusted