Results 1 to 3 of 3

Thread: sprite constructor

  1. #1

    Default sprite constructor

    in the example spriteRTS are new objects created with tho following code

    Code:
    Missile::Missile(World *world, GameObject *_owner)
    : GameObject(world)
    {
    	spriteMissile = new CL_Sprite("SpaceShootMissile", world->resources);
    	spriteExplosion = new CL_Sprite("Explosion", world->resources);
    	sound = new CL_SoundBuffer("MissileHit", world->resources);
    
    	collisionMissile = new CL_CollisionOutline("Gfx/spaceshoot_missile.png");
    	collisionMissile->set_alignment(origin_center);
    
    	sound->set_volume(1.0f);
    	sound->prepare();
    
    	sprite = spriteMissile;
    
    	hidden = false;
    	exploding = false;
    
    	owner = _owner;
    }
    My question is now, how the new sprites are created. Do all sprites with the same resource path have a pointer to the same databits, or do all instances of the Sprite have own image memory?

  2. #2
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Denmark
    Posts
    554

    Default

    The sprite image data is shared between all sprite objects constructed from the same resource manager with the same resource id.

  3. #3

    Default

    ok, thank you for your answer

Similar Threads

  1. Creation of CollisionOutline by using a Resource/Sprite
    By Nipsky in forum Official ClanLib SDK Forums
    Replies: 1
    Last Post: 09-22-2007, 10:08 PM
  2. Sprite patch for 0.8
    By Trigve in forum Official ClanLib SDK Forums
    Replies: 2
    Last Post: 07-19-2007, 12:41 AM
  3. Custom resource combined with sprite
    By tompawarrior in forum Official ClanLib SDK Forums
    Replies: 0
    Last Post: 07-17-2007, 05:30 PM
  4. Green border around rotated sprite on ATI cards - Solved!
    By pTymN in forum Official ClanLib SDK Forums
    Replies: 0
    Last Post: 11-06-2006, 08:44 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
  •