SFML community forums

Help => Graphics => Topic started by: BlurrOfDeath on November 30, 2014, 09:52:47 am

Title: Problem with creating a font/text[SOLVED]
Post by: BlurrOfDeath on November 30, 2014, 09:52:47 am
I've been trying to create a sf::Font and sf::Text but when I do it keeps giving an error that "fent/toxt does not name a type".
Help would be greatly appreciated:
struct VelText
{
    sf::Font fent;
    fent.loadFromFile("cour.ttf");

    sf::Text toxt;
    toxt.setFont(fent);
    toxt.setColor(sf::Color::Red);
    toxt.setPosition(0,500);

    void updateText(int nVelFact)
    {
        stringstream ss;
        ss << nVelFact;
        std::string strVelFact = ss.str();

        toxt.setString(strVelFact);
    }
};
 

FIXED:
Made the fent.loadFromFile etc. part of a create() function which solved the problem
Title: Re: Problem with creating a font/text[SOLVED]
Post by: Ixrec on November 30, 2014, 11:27:06 am
This is a standard C++ error you could easily google.  It most likely means you haven't included the headers for sf::Font and sf::Text in this piece of your code, so the compiler has no idea what those symbols mean.