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.


Topics - paxthewax

Pages: [1]
1
Graphics / sf::Text::setString() doesn't work for inconstant integers
« on: October 09, 2021, 04:51:51 am »
I have a sf::Font that is loaded and a sf::Text vector for all my texts in the game debug screen. I have created a variable for frame rate named FPS which is constantly changing... when I print the FPS variable just before using the setString() function, it prints out perfectly between 45-65, when it shows up on the window it says 1 or 0. PS: I am using a M1 Mac if that's pertinent to the problem.
Here is my code:
void IGGUI::update(float *dt)
{
    FPS = to_string(int(1 / *dt));
}
void IGGUI::render(RenderWindow *window)
{
    debug_screen.at(0).setString("Framerate: "+ FPS);
    debug_screen.at(1).setString("Current game state: Development");
    for(int i = 0; i < debug_screen.size(); i++)
    {
        window->draw(debug_screen.at(i));
    }
}
Any help would be appreciated it might be something stupid or something deeper... ;)

Pages: [1]