Visualizer Program by Anonymous Coder20th Oct 2005 0:50
|
---|
Summary This program has some nice pixel effects. All colors are drawn using memblocks. Description Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com REM Project: Visualizer REM Created: 10/18/2005 4:06:59 PM REM REM ***** Main Source File ***** REM gosub initvar gosub initscreen gosub initcolors gosub mainloop initvar: screenx as integer screeny as integer depth as integer bpp as integer blocksize as integer memptr as dword screenptr as dword ycount as integer xcount as integer red as integer green as integer blue as integer colorhold as dword x as integer y as integer pixcol as dword s as float colorhold as dword s=1 return initscreen: p=2 sync rate 0 sync on hide mouse screenx = 320 screeny = 200 depth = 32 bpp = depth/8 blocksize = screenx*screeny*bpp make memblock 1,blocksize set display mode screenx,screeny,depth memptr = get memblock ptr(1) screenptr = get pixels pointer() dim color(screeny,screenx) as dword dim oldcolor(screeny,screenx) as dword return initcolors: for ycount=0 to screeny-1 for xcount=0 to screenx-1 color(ycount,xcount)=rgb(rnd(255),rnd(255),rnd(255)) next xcount next ycount return mainloop: do gosub background gosub mouse gosub draw sync loop return background: invert=0 if spacekey()=1 invert=1 endif if shiftkey()=1 gosub initcolors endif if upkey()=1 s=s+.01 endif if downkey()=1 s=s-.01 endif if returnkey()=1 p=p+1 if p>2 p=1 endif endif for ycount=0 to screeny-1 for xcount=0 to screenx-1 oldcolor(ycount,xcount)=color(ycount,xcount) color(ycount,xcount)=(color(ycount-1,xcount+1)+color(ycount+1,xcount-1)+color(ycount-1,xcount-1)+color(ycount+1,xcount+1))/4 if invert=1 color(ycount,xcount)= colorhold colorhold=oldcolor(ycount,xcount)/s endif Write memblock dword 1,ycount*screenx*bpp+xcount*bpp,color(ycount,xcount) next xcount next ycount return mouse: mx=mousex() my=mousey() for a=0 to 40 for b=0 to 40 color(my+a,mx+b)=rgb(255,255,255) next zcounta next ycount return draw: lock pixels copy memory get pixels pointer(),memptr,blocksize unlock pixels set cursor 0,0 print screen fps() print s if p=2 print "Press space to scroll and shift to reset colors" print "Adjust color effect using up and down then hold space" print "Press enter to hide text" endif return |