Page 1 of 1
Make sprites screen sized!
Posted: Tue Aug 02, 2005 8:03 am
by Fou-Lu
I don't know if this is a bug or not. I don't know either if it has been mentioned before.
You probably know that the StartSpecialFX() command uses the phisic memory to make all those "alpha" and other effects faster. After it's all done, it copies the result to the video memory. What happens if we do that using a sprite buffer?
Code: Select all
Procedure ScreenSizeSprite(s.l)
usebuffer(s)
startspecialfx():displaysprite(s,0,0):stopspecialfx()
usebuffer(-1)
EndProcedure
Posted: Tue Aug 02, 2005 9:27 am
by Fou-Lu
Some code for you to test it: (just ctrl+c, ctrl+v)
Code: Select all
initsprite()
initkeyboard()
openscreen(320,240,16,"")
Procedure ScreenSizeSprite(s.l)
usebuffer(s)
startspecialfx():displaysprite(s,0,0):stopspecialfx()
usebuffer(-1)
EndProcedure
createsprite(0,128,128)
startdrawing(spriteoutput(0))
for y=0 to 63
c=1+random(15):mc=c
for x=0 to 63
c=c-1
if c<=-mc:c=1+random(15):mc=c
if x+c+16>63:c=(63-x)/2:mc=c:endif
red=random(2):endif
color=127-abs(127*c)/mc
plot(x+64,y+64,rgb(color*red,255-abs(x-32)*7,y*4))
plot(x+64,y,rgb(color*red,255-abs(x-32)*7,y*4))
plot(x,y+64,rgb(color*red,255-abs(x-32)*7,y*4))
plot(x,y,rgb(color*red,255-abs(x-32)*7,y*4))
next x
next y
stopdrawing()
usebuffer(0)
for g=0 to 63
grabsprite(200+g,g,0,64,48,#pb_sprite_memory)
grabsprite(100+g,g,g,64,48,#pb_sprite_memory)
next g
usebuffer(-1)
for g=0 to 63
usebuffer(100+g)
displaytranslucidesprite(263-g,0,0,64)
next g
repeat
i=i+1:if i>63:i=0:endif
ScreensizeSprite(100+i)
examinekeyboard()
flipbuffers()
until keyboardpushed(#pb_key_escape)
Sorry, it's a bit messy...

Posted: Tue Aug 02, 2005 4:21 pm
by netmaestro
Looks great. But I think you might mean <examinekeyboard()>

Posted: Wed Aug 03, 2005 3:03 am
by Fou-Lu
Thanks netmaestro, I corrected it. It was with examinemouse() because unlike normal people, I use mousebutton(1) to finish a program rather than keyboardpushed(#pb_key_escape)...
I found that by accident. I think this might be a bug, since it makes impossible to use SpecialFX() inside a sprite buffer.