Something that confuses me
Posted: Mon Apr 02, 2012 4:55 pm
How come this code shows only 0 in my text actor?
My games fps is set to 64 and I'm trying to make the actor show the percentage of the fps.
I've tried it in many ways and only time that I got close to what I want was with this code:
But it shows the number in this format: 75.000000
And I don't want those 0's to be there, but when using float there is no way to get them away.
So, can someone explain me what is wrong with the first code?
- Code: Select all
sprintf(text, "%i", round(real_fps/64)*100);
My games fps is set to 64 and I'm trying to make the actor show the percentage of the fps.
I've tried it in many ways and only time that I got close to what I want was with this code:
- Code: Select all
sprintf(text, "%f", (float)real_fps/64*100);
But it shows the number in this format: 75.000000
And I don't want those 0's to be there, but when using float there is no way to get them away.
So, can someone explain me what is wrong with the first code?