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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - idmantob

Pages: [1]
1
General / Problems with Text
« on: November 17, 2020, 07:24:32 am »
I'm very new to programming. I am trying to set a Text variable in a class
class myclass
{
private:
           Text m_name;
public:
           void setName(Text name);
           Text getName();
}
void setName(Text name)
{
m_name = name
}
Text getName()
{
return m_name;
}

in a .h file:

Text name;
Font font;
fond.loadFromFile(fonts/arial.ttf);
name.setFont(font);
name.setcharacterSize(12);
name.setFillColor(Color::White);
name.setPosition(x,y);
std::stringstream tname;
tname << x;
name.setString(tname.str());
myclass.setName(name);


Then basically I'm doing:
int main()
{
window.draw(name); //this comes back with an exception error
}

I think there's a problem with the font, but not sure. Any suggestions?

Pages: [1]
anything