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

Author Topic: text doesnt show up in app  (Read 1110 times)

0 Members and 1 Guest are viewing this topic.

Ogn1k

  • Newbie
  • *
  • Posts: 4
    • View Profile
text doesnt show up in app
« on: December 02, 2020, 12:57:45 pm »
void loadClass::buttonColor(RenderWindow& window, int a, int b, int c, int d, Text e)
{
    if (IntRect(a, b, c, d).contains(Mouse::getPosition(window)))
    {
        e.setFillColor(Color::Yellow);
    }
    else
    {
        e.setFillColor(Color::White);
    }
}
this fuctrion somewhy didnt work, help please! whats wrong?

Stauricus

  • Sr. Member
  • ****
  • Posts: 369
    • View Profile
    • A Mafia Graphic Novel
    • Email
Re: text doesnt show up in app
« Reply #1 on: December 02, 2020, 03:06:52 pm »
the 'e' variable (Text) is destroyed when the function ends, so there is no text at all to draw.
also, you don't have a font attached to the Text. and the text itself is not being drawn to any window.
Visit my game site (and hopefully help funding it? )
Website | IndieDB

Ogn1k

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: text doesnt show up in app
« Reply #2 on: December 02, 2020, 07:38:25 pm »
the 'e' variable (Text) is destroyed when the function ends, so there is no text at all to draw.
also, you don't have a font attached to the Text. and the text itself is not being drawn to any window.
thanks, that helpd. Now function looks like this
Text loadClass::buttonColor(Text e, int a, int b, int c, int d, RenderWindow& window )
{
        if (IntRect(a, b, c, d).contains(Mouse::getPosition(window)))
        {
                e.setFillColor(Color::Yellow);
        }
        else
        {
                e.setFillColor(Color::White);
        }
        return e;
}
also it needs to be in rendering function ;D

 

anything