i am also very aware code usually cant just run backwards. but it seems to be jumping back to where the instance of the image was created.
so here is what i did. i made the vector of my class image public.
when i do this:
T9::image * myimage = new T9::image("./graphics/metal.jpg");
T9::tec9::Instance()->images.push_back(myimage);
after i call push_back on images, it goes back to where my image was created. creating an infinite loop! simply pushing the class onto the stack is creating the problem! here is my image class.
class image
{
public:
image::image (string filename);
sf::Image * GetImage () { return & Image; };
private:
sf::Image Image;
};
explain that!
if i comment out the line where i add the image to the array of images, and simply just use it to create a sprite, it works without a hitch:
T9::image * myimage = new T9::image("./graphics/metal.jpg");
T9::sprite mysprite(myimage);
statemanager::AddSprite(T9::States::mainmenu, mysprite);
the above code is located on initialization of a manager class