Does not work "VDP_resetSprites ()"

SGDK only sub forum

Moderator: Stef

Post Reply
Mixail
Very interested
Posts: 133
Joined: Thu Nov 18, 2010 4:47 pm

Does not work "VDP_resetSprites ()"

Post by Mixail » Tue May 23, 2017 6:36 pm

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 ()".

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: Does not work "VDP_resetSprites ()"

Post by Stef » Wed May 24, 2017 10:15 am

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) :)

Mixail
Very interested
Posts: 133
Joined: Thu Nov 18, 2010 4:47 pm

Re: Does not work "VDP_resetSprites ()"

Post by Mixail » Wed May 24, 2017 11:06 am

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?

Post Reply