well... That did get it loaded... now its throwing exceptions in release mode and randomly corruption the stack in debug mode... I dont understand. I've been doing this for a long time now, and never before have I ran into something seamlessly corruption my stack -.- anyway... Here is the member function thats having issues:
void Graph::draw(sf::RenderWindow& window){
for(int j=0; j<nodes.size(); j++){
for(int i=0; i<nodes.at(j)->edges.size(); i++){
double startX=nodes.at(j)->edges.at(i)->start->x;
double startY=nodes.at(j)->edges.at(i)->start->y;
double endX=nodes.at(j)->edges.at(i)->end->x;
double endY=nodes.at(j)->edges.at(i)->end->y;
sf::Vertex line[2]={
sf::Vertex(sf::Vector2f(startX, startY)),
sf::Vertex(sf::Vector2f(endX, endY))
};
window.draw(line, 2, sf::Lines);
sf::CircleShape temp(5, 3);
temp.setOrigin(5, 5);
temp.setPosition(endX, endY);
double theta;
if(endX==startX&&startY<endY)
theta=3.1415/2;
else if(endX==startX&&endY<startY)
theta=3*3.1415/2;
else{
theta=atan((endY-startY)/(startX-endX));
if(endX>startX)
theta=3.1415-theta;
if(endY>startY)
theta=-theta;
if(endX>startX&&endY<startY)
theta=-theta;
}
temp.rotate(30);
temp.rotate(-180/3.1415*theta);
temp.move(10*cos(theta), -10*sin(theta));
window.draw(temp);
std::ostringstream strs;
strs << nodes.at(j)->edges.at(i)->size;
std::string str = strs.str();
sf::Text tempTxt("str", font, 50);
tempTxt.setFont(font);
tempTxt.setString(str);
tempTxt.setPosition((startX+endX)/2+(startX-endX)/5, (startY+endY)/2+(startY-endY)/5);
tempTxt.setCharacterSize(12);
tempTxt.setColor(sf::Color(0, 255, 255, 255));
window.draw(tempTxt);
}
}
//From here and onwards the stack gets randomly corrupted...
for(int j=0; j<nodes.size(); j++){
sf::Text tempTxt("str", font, 50);
tempTxt.setFont(font);
tempTxt.setString(nodes.at(j)->name);
tempTxt.setPosition(sf::Vector2f(nodes.at(j)->x, nodes.at(j)->y-20));
tempTxt.setCharacterSize(12);
tempTxt.setColor(sf::Color(255, 255, 0, 255));
window.draw(tempTxt);
sf::CircleShape temp(5, 60);
temp.setOrigin(5, 5);
temp.setPosition(sf::Vector2f(nodes.at(j)->x, nodes.at(j)->y));
temp.setFillColor(sf::Color(255, 0, 0, 255));
window.draw(temp);
}
}
Anything not related directly to the font (which is a private member of the Graph class) works just fine. All the drawables work no problem... This is just so confusing -.-
EDIT: What's even better, none of this happens if I don't load the font -.-