[SDL] pre-load frames in memory

Tom Wilson t.wilson at hazid.com
Sun Jun 12 04:20:00 PDT 2005


talie wrote:
> Hi!
> 
> I am doing a game.  I want to pre-load all animations in memory at the 
> beginning of the game in order to have good performance.
> 
> I have a total of 36 animation of 80 frames to load (I use IMG_Load).  Each 
> frame (jpg file) have 22K.  It gives 1760 K per animation. But when a load an 
> animation, my memory goes down by 62 MB ... 62 MB per animation... I have 36 !!!
> 
> Please help !  How can I do this pre-load ???
> 
> THANK !


Another thing, try putting all of your images for an animation onto one 
image, rather than an image for each frame.

The extra memory used for each Surface struct will soon add up if you 
have 36 x 80 frames.

- Tom






More information about the SDL mailing list