Page 1 of 1

sprite engine init cacheSize

Posted: Thu Sep 17, 2015 2:20 pm
by matteus
I understand that SPR_init defines the tile allocation size. Must this number contain the total number of tiles for a complete animation of a sprite? So if I define a 10 x 6 (60 tile sprite) that has 10 frames of animation must I init the engine with 600 tiles or 60 tiles?

From my own observations of VRAM I'm going to say 60 but I'd like confirmation :)

Re: sprite engine init cacheSize

Posted: Thu Sep 17, 2015 7:58 pm
by Stef
SPR_init(..) defines the number of reserved tiles in VRAM for sprite display.
You don't have to reserve tiles for all animation, i would say you just need to reserve as much tiles that visible sprites are using... but that is not totally true. As you may have sort of "double buffering" (mean we load tiles for a new sprite animation frame while the previous is still displayed) it is usually better to reserve more. Imagine you want to display 10 sprites of 16 tiles each then a good cache size will be 16*10*2 (320).