BBasic-Miku感谢祭倒计时2013
Miku总能激发'创作的灵感!
于是乎、
渐渐出构建基于BBaisc语言的Miku倒计时 。
语言:BBaisc。
UI:使用了Metro的磁块UI。
功能:输入日期将计算出当前日期距Miku演唱会的天数。
背景:使用标准的24位GB颜色。
设计构思:
源码草图:
Dim homepic,surepic,nopic,backpic,k,penx,peny,uppic,downpic,wait,savepic,happypic,loada,loadb,hadpic,modea,modeb,loada$,loadb$,date,day wait=1 modea=0 modeb=0 loada$=":-( Miku香港演唱会举办完了…" loadb$=":-( Miku台湾演唱会举办完了…" setbkmode(transparent) '------图片读取------ homepic=loadres("MikuLoad.lib",1) surepic=loadres("MikuLoad.lib",2) nopic=loadres("MikuLoad.lib",3) backpic=loadres("MikuLoad.lib",4) uppic=loadres("MikuLoad.lib",5) downpic=loadres("MikuLoad.lib",6) savepic=loadres("MikuLoad.lib",7) happypic=loadres("MikuLoad.lib",8) hadpic=loadres("MikuLoad.lib",9) fillpage(-1,0,0,240,320,184125000) showpic(-1,homepic,0,0,240,320,0,0,1) open "MikuLoad.sav" for binary as #1 get #1,date get #1,day if lof(1)=0 then date=1 day=1 end if close #1 waitkey() cls 001 modea=0 modeb=0 fillpage(-1,0,0,240,320,184125000) fillpage(-1,10,20,190,70,000180000) fillpage(-1,10,200,90,70,000180000) fillpage(-1,110,200,90,70,000180000) fillpage(-1,10,110,90,70,000180000) font(font_16hei) pixlocate(160,70) print"开始" pixlocate(60,160) print"计算" pixlocate(60,250) print"概况" pixlocate(160,250) print"退出" while wait>=0 k=waitkey() penx=getpenposx(k) peny=getpenposy(k) if penx>=10 and penx<=200 then if peny>=20 and peny<=90 then goto 002 end if end if if penx>=10 and penx<=100 then if peny>=110 and peny<=180 then goto 003 else if peny>=200 and peny<=270 then goto 004 end if end if if penx>=110 and penx<=200 then if peny>=200 and peny<=270 then end end if end if wend '------选择日期界面------- 002 cls fillpage(-1,0,0,240,320,184125000) fillpage(-1,140,20,100,50,000180000) showpic(-1,uppic,40,110,60,30,0,0,1) showpic(-1,uppic,140,110,60,30,0,0,1) showpic(-1,downpic,40,190,60,30,0,0,1) showpic(-1,downpic,140,190,60,30,0,0,1) 'showpic(-1,surepic,20,270,80,30,0,0,1) showpic(-1,backpic,140,270,80,30,0,0,1) font(font_16hei) pixlocate(175,48) print"选择日期" font(font_24hei) pixlocate(58,153) print date pixlocate(158,153) print day pixlocate(85,153) print"月" pixlocate(185,153) print"日" pixlocate(0,85) print"2012年" while wait>=0 k=waitkey() penx=getpenposx(k) peny=getpenposy(k) if penx>=40 and penx<=100 then if peny>=110 and peny<=140 then date=date+1 if date>12 then date=1 end if fillpage(-1,58,153,24,24,184125000) pixlocate(58,153) print date else if peny>=190 and peny<=220 then date=date-1 if date<1 then date=12 end if fillpage(-1,58,153,24,24,184125000) pixlocate(58,153) print date end if else if penx>=140 and penx<=200 then if peny>=110 and peny<=140 then day=day+1 if date=2 then if day>29 then day=1 end if else if date=4 then if day>30 then day=1 end if else if date=6 then if day>30 then day=1 end if else if date=9 then if day>30 then day=1 end if else if date=11 then if day>30 then day=1 end if else if day>31 then day=1 end if end if fillpage(-1,158,153,24,24,184125000) pixlocate(158,153) print day else if peny>=190 and peny<=220 then day=day-1 if day<1 then day=1 end if fillpage(-1,158,153,24,24,184125000) pixlocate(158,153) print day end if if penx>=20 and penx<=100 then if peny>=270 and peny<=300 then goto 003 end if else if penx>=140 and penx<=220 then if peny>=270 and peny<=300 then goto 001 end if end if end if wend 003 cls if date=1 then loada=31-day+244 loadb=loada+4 else if date=2 then loada=29-day+215 loadb=loada+4 else if date=3 then loada=31-day+184 loadb=loada+4 else if date=4 then loada=30-day+154 loadb=loada+4 else if date=5 then loada=31-day+123 loadb=loada+4 else if date=6 then loada=30-day+93 loadb=loada+4 else if date=7 then loada=31-day+62 loadb=loada+4 else if date=8 then loada=31-day+31 loadb=loada+4 else if date=9 then loada=30-day+1 loadb=loada+4 else if date=10 then if day<=2 then loada=2-day loadb=loada+4 else if day>2 and day<=7 then modea=1 loada=0 loadb=6-day else if day>7 then modea=1 modeb=1 end if else if date>10 then modea=1 modeb=1 loada=0 loadb=0 end if fillpage(-1,0,0,240,320,184125000) fillpage(-1,140,20,100,50,000180000) showpic(-1,savepic,140,270,80,30,0,0,1) 'showpic(-1,backpic,140,270,80,30,0,0,1) font(font_16hei) pixlocate(190,48) print"倒计时" pixlocate(70,130) print"今天是"+date+"月"+day+"日。" showpic(-1,happypic,0,90,60,60,0,0,1) pixlocate(0,175) print"距Miku香港演唱会(10月2日)还有:" pixlocate(0,225) print"距Miku台湾演唱会(10月6日)还有:" font(font_24hei) pixlocate(175,191) print loada pixlocate(175,241) print loadb font(font_16hei) pixlocate(215,199) print"天。" pixlocate(215,249) print"天。" if modea=1 then fillpage(-1,0,174,240,42,184125000) pixlocate(0,175) print loada$ end if if modeb=1 then fillpage(-1,0,224,240,42,184125000) pixlocate(0,225) print loadb$ end if while wait>=0 k=waitkey() penx=getpenposx(k) peny=getpenposy(k) if penx>=140 and penx<=220 then if peny>=270 and peny<=300 then open "MikuLoad.sav" for binary as #2 put #2,date put #2,day close #2 fillpage(-1,140,270,80,30,184125000) modea=0 modeb=0 showpic(-1,backpic,140,270,80,30,0,0,1) showpic(-1,hadpic,140,20,100,50,0,0,1) waitkey goto 001 end if end if wend '--------简介界面--------- 004 cls fillpage(-1,0,0,240,320,184125000) print"初音Miku香港&台湾公演日MIKUPA" font(font_12hei) print"" print":-) 香港公演" print"公演日:" print"2012年10月2日" print"会场:" print"KITEC Star Hall (www.kitec.com.hk)" print"开场/开演时间:" print"昼公演:14:00/15:00" print"夜公演:19:00/20:00" print print":-) 台湾公演" print"公演日:" print"2012年10月6日" print"会场:" print"Taipeishow台北展演二馆" print"http://www.taipeishow.com.tw/" print"开场/开演时间:" print"昼公演:13:00/14:00" print"夜公演:18:00/19:00" print print"协力:" print"SEGA/Crypton Future Media,Inc" print"Graphics by SEGA" print"Organized by MIKUPA Overseas Partnership" waitkey goto 001
运行结果:
@ Mayuko