Results 1 to 2 of 2

Thread: Memory management of CL_Sprite

  1. #1

    Question Memory management of CL_Sprite

    I'm building a Breakout clone where naturally the same sprite is drawn on screen multiple times. Until now I stored a CL_Sprite for each Brick, which loads the image data from a CL_ResourceManager.

    When I load the same sprite from the resource manager, is the image data stored individually for each sprite or only once in total? Ergo is it advisable to store each CL_Sprite only once and call its draw-function from different locations in the code OR may each object on screen as well have its own CL_Sprite without a great deal of memory consumption?

  2. #2
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    When CL_Sprite or CL_Image loads a texture, it checks to see if it has already been loaded.

    So, if you have multiple CL_Sprites pointing to the same file, only a single file is held in memory.

    For interest, internally it uses http://www.clanlib.org/docs/clanlib-...redGCData.html "load_texture" to share the data. Note, the CL_SharedGCData class is only for experienced users of ClanLib - You should never need to use it. (I have never used it)

Similar Threads

  1. CL_Sprite change to ClanLib 0.8 and 0.9
    By rombust in forum Official ClanLib SDK Forums
    Replies: 0
    Last Post: 04-21-2009, 09:55 AM
  2. CL_Sprite mouse cursor
    By AlfaRed in forum Official ClanLib SDK Forums
    Replies: 2
    Last Post: 02-11-2009, 09:29 AM
  3. cl_sprite with multiple frames
    By dwune in forum Official ClanLib SDK Forums
    Replies: 7
    Last Post: 08-29-2008, 08:49 AM
  4. newbie memory management
    By celtx in forum Official ClanLib SDK Forums
    Replies: 0
    Last Post: 11-09-2007, 12:13 PM
  5. CL_Sprite problems
    By gmatt in forum Official ClanLib SDK Forums
    Replies: 0
    Last Post: 06-29-2007, 05:38 PM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •