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 - paxthewax

Pages: [1]
1
Graphics / Re: sf::Text::setString() doesn't work for inconstant integers
« on: October 12, 2021, 01:46:12 am »
I don't know if this is a bug or something but I tried everything and it doesn't work, I have went on multiple forums including stack overflow, reddit, discord and this. I print out the Fps right before the setString and it shows in the console as 45-60 but when I put it in the setString function it goes from 0 - 1 on my screen... I have no idea what this is and neither does anyone that has seen this post. I am quite new to this forum, do I file a bug report or something else? A quick reply would be appreciated. Thanks
-Pacifik

2
Graphics / Re: sf::Text::setString() doesn't work for inconstant integers
« on: October 11, 2021, 06:33:09 pm »
In my IGGUI.hpp file it is defined :
private:
    Font main_font;
    vector<Text> debug_screen;
    float debug_screen_length;
    string FPS;
    void init_variables();

};

3
Graphics / Re: sf::Text::setString() doesn't work for inconstant integers
« on: October 09, 2021, 03:00:34 pm »
Hi I tried that and it still shows up on the screen as Framerate: 1 and it shifts between 1 and 0...  :-\

4
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]