Hey guys, just a little problem.
I have a vector of a class called gText,
I know for a fact that gText works as i use it for something else, but i cant seem to get it to work in a different state...
this is my code for the working piece i already have
gText tempText;
tempText.setUpInt(monsters.at(i).pos,monsters.at(i).rtnDam(),font);
texts.push_back(tempText);
and in my draw method it draws it fine,
also pos is just a simple rect class i made, the rtnDam is just a int and font is a variable that holds a sf::Font
so i then put this code to draw some text on screen
gText tmpText;
rect pos;
pos.x = 200;
pos.y = 100;
pos.h = 1;
pos.w = 1;
tmpText.setUpText(pos,"text",font);
texts.push_back(tmpText);
now if i run any method from my gText class, i can return the text, i can also return its pos. but with this code
for(int i=0;i<texts.size();i++){if(texts.at(i).rtnAlive() == true){screen.draw(texts.at(i).rtnText());}}
i get a huge access violation error which im really confused about. can anyone tell me whats wrong?
Cheers.
Its ok, i found out it was going out of scope, and as i could access the string and pos, i still couldnt access the sf::text cause of how sfml is coded
, but i fixed it. cheers