rem COBWEBS ............. Rev 2.4 rem A J Tooth /Modified 25th Jan & 13th Sept 2003 rem Minor modifications made July 2004 rem Modified March 2006 remon error if (err=17) then quit *FLOAT 64 rem Screensaver preamble rem +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ if instr(@cmd$, "/c") then sys "MessageBox", 0, "This screen saver has no options.", "", 48 quit endif Preview% = instr(@cmd$, "/p") if Preview% then sys "SetWindowLong", @hwnd%, -16, &50000000 hparent% = valmid$(@cmd$, Preview%+2) sys "SetParent", @hwnd%, hparent% sys "SetWindowLong", @hwnd%, -8, hparent% sys "GetClientRect", hparent%, ^V% XScreen% = X% YScreen% = Y% sys "MoveWindow", @hwnd%, 0, 0, XScreen%, YScreen%, 0 else sys "SetWindowLong", @hwnd%, -16, &16000000 sys "GetSystemMetrics", 0 to XScreen% sys "GetSystemMetrics", 1 to YScreen% sys "SetWindowPos", @hwnd%, -1, 0, 0, XScreen%, YScreen%, 0 endif vdu 26 : colour 15 : colour 128 : cls sys "ShowWindow", @hwnd%, 1 mouse X0%,Y0%,B0& off rem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ rem Setup proc_setup *REFRESH OFF repeat rem Special Screensaver exit if Preview%=0 then if inkey(2)<>-1 then quit if (inkey(-1) or inkey(-2) or inkey(-3) or inkey(-99)) then quit mouse Xx%,Yy%,Bb& sys "Sleep",5 if (Xx%<>X0% or Yy%<>Y0% or Bb&>0) then quit endif rem Fix Origin and Colour of next Cobweb proc_OrCol rem Cobweb drawing Section proc_Draw *REFRESH rem Clear screen to new Colour when max number of cobwebs plotted proc_Cls until false *REFRESH ON quit end rem End of Program ++++++++++++++++++++++++++++++++++++++++++++++++++ rem Setup def proc_setup dim x%(25),y%(25) rem Various control variables tck&=0 : t&=10 : cnt%=0 : lmt%=100 : rem lmt% is the max number of Cobwebs rem Initial background colour is BLACK rr&=0 : gg&=0 : bb&=0 : cl&=10 colour 130,rr&,gg&,bb& colour 130 : cls endproc rem =============================================================== rem Cobweb drawing Section def proc_Draw local a&,fc,rm&,gm&,bm&,s&,l&,d&,angle sys "GetCurrentProcess" to hprocess% sys "SetPriorityClass", hprocess%, &100 for a&=cl& to 1 step-1 rem Reduce width of line, merging back/fore-ground colours @vdu%!248=a& fc=a&/cl& rm&=int(rr&*fc + r&*(1-fc)) gm&=int(gg&*fc + g&*(1-fc)) bm&=int(bb&*fc + b&*(1-fc)) colour 10,rm&,gm&,bm& : gcol 10 rem Draw radii for s&=1 to side& angle=(s&-1)*2*pi/side& x%(s&)=int(rdius%*cos(rad(twisth%))*cos(angle)) y%(s&)=int(rdius%*cos(rad(twistv%))*sin(angle)) move xor%,yor% plot 5,xor%+x%(s&),yor%+y%(s&) next rem Draw radial links for l&=1 to 8 for d&=1 to (side&-1) move xor%+x%(d&)*l&/t&,yor%+y%(d&)*l&/t& plot 5,xor%+x%(d&+1)*l&/t&,yor%+y%(d&+1)*l&/t& next move xor%+x%(side&)*l&/t&,yor%+y%(side&)*l&/t& plot 5,xor%+x%(1)*l&/t&,yor%+y%(1)*l&/t& next next a& sys "GetCurrentProcess" to hprocess% sys "SetPriorityClass", hprocess%, &20 endproc rem =============================================================== rem Defines Origin and Colours def proc_OrCol rem Fix origin of next Cobweb xor%=rnd(2*XScreen%) : yor%=rnd(2*YScreen%) : rdius%=rnd(350)+100 rem Redefine Graphics origin as centre of next Cobweb side&=rnd(20)+3 : rem Fix number of radii rem Set random angles by which each cobweb is rotated twisth%=rnd(80) : twistv%=rnd(80) rem Choose random colour with overall red, green or blue hue if cnt%=0 then tck&+=1 : if tck&=4 then tck&=1 case tck& of when 1 : r&=2*?lmt% : g&=rnd(256)-1 : b&=rnd(256)-1 when 2 : r&=rnd(256)-1 : g&=2*?lmt% : b&=rnd(256)-1 when 3 : r&=rnd(256)-1 : g&=rnd(256)-1 : b&=2*?lmt% otherwise error endcase endproc rem =============================================================== rem Clear Screen to Random Background Colour def proc_Cls local h&,gr& cnt%+=1 if cnt%=lmt%*(1-(h&=4)) then h&=rnd(5)-1 gr&=100+rnd(155) rr&=-gr&*(h&=4)-(h&=1)*30 gg&=-gr&*(h&=4)-(h&=2)*30 bb&=-gr&*(h&=4)-(h&=3)*30 colour 130,rr&,gg&,bb& colour 130 : cls cnt%=0 endif endproc rem ===============================================================