1
General / Re: when do i dynamicaly allocate my variables/array
« on: May 08, 2013, 12:01:37 pm »
would this be the correct way to use c++/sfml in order to avoid memory leaks?:
// Load a sprite to display
sf::Texture texture;
if (!texture.loadFromFile(resourcePath() + "cute_image.jpg")) {
return EXIT_FAILURE;
}
sf::Sprite sprite(texture);
//use my sprite in the game...
sprite.~Sprite();
texture.~Texture();
// Load a sprite to display
sf::Texture texture;
if (!texture.loadFromFile(resourcePath() + "cute_image.jpg")) {
return EXIT_FAILURE;
}
sf::Sprite sprite(texture);
//use my sprite in the game...
sprite.~Sprite();
texture.~Texture();