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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Eric

Pages: [1]
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();

2
General / when do i dynamicaly allocate my variables/array
« on: May 07, 2013, 11:05:56 pm »
i'm still new to c++ but i've been reading about it :-)

in the simple example when i run the sfml template fromxcode it creates a sound, a background image and a text in the upper right corner
sf:texture texture allocate a place for my texture?
but it is not dynamically - meaning i can't free the memory? Right?
If i want to do level1 and level 2 everything  concerning level 1 should be dynamicaly allocated so that i can free the memory for level2 - right?

I've always had a garbage collector to clean my programs, so I have to ask these simple questions :-)

Thanks a lot for your help. I can't wait to write 'yet-another-space-invaders' using SFML.
Regards Eric

3
General / Re: Starting with SFML - coming form a java world!
« on: May 06, 2013, 10:01:02 am »
I've ordered som c++ books and while I wait I follow this 'course': http://www.learncpp.com

I strongly recommend this page if other wants to learn c++ without a book!

4
General / Starting with SFML - coming form a java world!
« on: May 05, 2013, 09:34:14 am »
Congratulations with the release of 2.0! I just managed to get the old 2.0 installed on my Xcode a week ago :-) I  find it very interesting

I'm an experienced java-programmer and I've heard a lot about memory leaks, pointers and other warnings about c++ in the past - but I really like SFML and want to try it out

I have a question regarding the C++ language. I know there is no garbage collector in c++, but should I worry about destroying objects / smart pointers and stuff in C++? I'm new to c++ but syntax seems very familiar and I want to learn that language.

Eric

Pages: [1]