rem Twister ....... rev 3.1 rem A J Tooth//Xmas 2007 rem Preamble================================== on error if (err=17) then quit *FLOAT 64 himem=lomem + 100000000 install @lib$+"MyUtils.bbc" install @lib$+"BMP_Utils.bbc" rem Preamble================================== rem Intro proc_intro rem Maximise window proc_fullscreen(xscreen%,yscreen%) rem Get a picture proc_GetPic rem Setup 256 sub-bitmaps proc_subset rem Setup ASM proc_ASMsetup rem Split the picture proc_split a$="" : a%=0 : ch%=1 origin xscreen%,yscreen% repeat rem Display sub-pics proc_subdisp(a%) rem Update angle proc_event(a$,b&) case asc(a$) of when 137,140: a%+=1 when 136,141: a%-=1 endcase if a%>90 then a%=90 if a%<-90 then a%=-90 until a$=" " or b&<>0 if b&=4 then run else quit quit rem End of Program ======================================================== rem ======================================================================= rem Intro def proc_intro rem Maximise screen proc_maxim(xscreen%,yscreen%) colour 132,25,0,0 : colour 132 : colour 0,25,0,0 : cls proc_locback(50,fn_adapt(1,800),1500,fn_adapt(1,600),25,0,0) msg$="\2This program cuts a picture up into \1N x N \2pieces" proc_msg("Georgia",12,"B",150,fn_adapt(1,1350),msg$) msg$="\2It then rotates the pieces according to an angle determined by \nrotating the \3mouse wheel \2or pressing the \3left/right arrows" proc_msg("Georgia",12,"B",150,fn_adapt(1,1300),msg$) msg$="\2Then at any time \3left-click \2to choose another picture, or \3right click \2to \1QUIT" proc_msg("Georgia",12,"B",150,fn_adapt(1,1200),msg$) msg$="\1First, you need to choose the number of pieces to chop up the picture;\n\3rotate the mouse wheel \1or press the \3up/down arrows \1then \3left-click \1 to select" proc_msg("Georgia",12,"B",150,fn_adapt(1,1150),msg$) msg$="\3Pieces=" proc_msg("Georgia",12,"B",150,fn_adapt(1,1050),msg$) Sub%=fn_islct(8,16,256,300,1050,2) msg$="\2Now press \3any key \2or \3left-click \2to select a picture" proc_msg("Georgia",12,"B",150,fn_adapt(1,1000),msg$) proc_event(a$,b&) endproc rem ================================================================== rem Prints the backdrop for the screen message def proc_locback(Xs%,Ys%,Ws%,Hs%,Rr&,Gg&,Bb&) local h&,Rf&,Gf&,Bf& for h&=0 to 50 Rf&=Rr&*h&/50 : Gf&=100*(50-h&)/50 + Gg&*h&/50 : Bf&=Bb&*h&/50 colour 15,Rf&,Gf&,Bf& : gcol 15 rectangle fill Xs%+h&,Ys%+h&,Ws%-2*h&,Hs%-2*h& next h& endproc rem ======================================================================== rem Parameter selection function - integers def fn_islct(Mn%,Typ%,Mx%,Xp%,Yp%,Oc&) : local x%, y%, b&, cur%, in& rem Mouse debounce routine repeat mouse x%,y%,b& until b&=0 colour 1 cur%=Typ% curold%=cur% repeat msg$="\0"+str$(curold%) proc_msg("Georgia",12,"B",Xp%,fn_adapt(1,Yp%),msg$) msg$="\"+str$(Oc&)+str$(cur%) proc_msg("Georgia",12,"B",Xp%,fn_adapt(1,Yp%),msg$) mouse x%,y%,b& sys "Sleep",10 rem Raise / lower parameter if mouse wheel rotated in&=inkey(2) case in& of when 139,141: curold%=cur% : if cur%>Mn% then cur%/=2 when 138,140: curold%=cur% : if cur%