Page 1 of 1
Does not work "VDP_resetSprites ()"
Posted: Tue May 23, 2017 6:36 pm
by Mixail
Code: Select all
int num=0;
int x=0;
for (;;){
num=0;
VDP_resetSprites ();
VDP_setSpriteFull(num++, 50+x, 50, SPRITE_SIZE(4, 4), TILE_ATTR(1, 0, 0, 0) | 3, num+1);
VDP_setSpriteFull(num++, 50+x, 150, SPRITE_SIZE(4, 4), TILE_ATTR(1, 0, 0, 0) | 0, num+1);
VDP_setSpriteFull(num++, 20+x, 50, SPRITE_SIZE(4, 4), TILE_ATTR(1, 0, 0, 0) | 3, num+1);
if(x==5){
VDP_setSpriteFull(num++, 20+x, 20+x, SPRITE_SIZE(4, 4), TILE_ATTR(1, 0, 0, 0) | 3, num+1);
VDP_updateSprites(4, 1);
}
else VDP_updateSprites(3, 1);
x ++;
VDP_waitVSync ();
VDP_resetSprites ();
VDP_releaseAllSprites ();
VDP_clearSprites ();
}
How to reset sprites? Does not work "
VDP_resetSprites (), VDP_releaseAllSprites (), VDP_clearSprites ()".
Re: Does not work "VDP_resetSprites ()"
Posted: Wed May 24, 2017 10:15 am
by Stef
It depends from what you mean by "reset sprites".
If you only want to hide them then just does VDP_clearSprites()
If you want to reset everything (release allocated sprites and clear them) then use VDP_resetSprites() (internally it calls VDP_releaseAllSprites() and VDP_clearSprites())
note that you *always* need to call VDP_updateSprites(..) after to send the changes into the VDP
Since the last version of SGDK (1.22) you can just use VDP_updateSprites(0, ...) to hide sprites. 0 is a special value here to do that action (it internally calls VDP_clearSprites() before sending modifications to VDP in that case)
Re: Does not work "VDP_resetSprites ()"
Posted: Wed May 24, 2017 11:06 am
by Mixail
Code: Select all
if(x==5){
VDP_setSpriteFull(num++, 20+x, 20+x, SPRITE_SIZE(4, 4), TILE_ATTR(1, 0, 0, 0) | 3, num+1);
VDP_updateSprites(4, 1);
}
The fourth sprite displayed on the screen. How do I reset it? What would be displayed three sprite.
How to organize the correct cycle of output of sprites on the screen?