Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: sf::Image Image;// How I delete after use ???  (Read 2283 times)

0 Members and 1 Guest are viewing this topic.

JeZ-l-Lee

  • Jr. Member
  • **
  • Posts: 80
    • ICQ Messenger - 223180991
    • MSN Messenger - JeZLee@Live.com
    • AOL Instant Messenger - SLNTHERO@aol.com
    • View Profile
    • http://www.SilentHeroProductions.com
    • Email
sf::Image Image;// How I delete after use ???
« on: February 04, 2009, 05:28:17 pm »
sf::Image Image;// How I delete after use ???

Hi Again,

Killer game engine library!
Well here is part of my source, please look and help me !

Code: [Select]
sf::Image Image;

if (!Image.LoadFromFile("cute_image2.bmp"))
return EXIT_FAILURE;

Image.CreateMaskFromColor(sf::Color(0, 255, 0, 255), 0);

#define NumberOfSprites 400
sf::Sprite Sprites[NumberOfSprites];
for (uint16_t index = 0; index < NumberOfSprites; index++)
Sprites[index].SetImage(Image);

// delete Image;//  <- compiler ERROR, why? How do I delete Image???
JeZ+Lee
Silent Hero Productions(R)
Video Game Design Studio

http://www.SilentHeroProductions.com

Daazku

  • Hero Member
  • *****
  • Posts: 896
    • View Profile
sf::Image Image;// How I delete after use ???
« Reply #1 on: February 04, 2009, 05:30:39 pm »
Okai! You REALLY should learn c++.

You can't delete a variable instanciated like that. Delete is to use only with New.
Pensez à mettre le tag [Résolu] une fois la réponse à votre question trouvée.
Remember to add the tag [Solved] when you got an answer to your question.

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
sf::Image Image;// How I delete after use ???
« Reply #2 on: February 04, 2009, 05:39:29 pm »
Anyway, if you delete your sf::Image, even if you had used SetImage on your sf::Sprite, you're going to have a with rect on your screen.
SFML / OS X developer