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

Author Topic: Problem with creating a font/text[SOLVED]  (Read 1266 times)

0 Members and 1 Guest are viewing this topic.

BlurrOfDeath

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • Email
Problem with creating a font/text[SOLVED]
« 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
« Last Edit: November 30, 2014, 10:29:52 am by BlurrOfDeath »

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: Problem with creating a font/text[SOLVED]
« Reply #1 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.