Jump to content

  • Log In with Google      Sign In   
  • Create Account


Display fps


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 Lafo   Members   -  Reputation: 122

Like
Likes
Like

Posted 11 August 1999 - 06:13 PM

Hello, i'm trying to figure out a way to show the fps on screen.

I want to display the fps using TextOut, but my variable is an integer ans TextOut only accept String.

How can I change my int into a char[] or is there another way to show the fps without TextOut.

Lafo



Sponsor:

#2 The Madman   Members   -  Reputation: 122

Like
Likes
Like

Posted 05 August 1999 - 02:02 PM

OK, assuming string OhYes and integer ItFeelsGood holding the frame rate, here's how you would put the integer value into a string:

sprintf(OhYes, "Frame Rate: %d", ItFeelsGood);

Hope that helps.

------------------
That's how you do it, but that's just the opinion of a MADMAN!!! BWAHAHAAHAHA! :D :D :D


#3 White Fire   Members   -  Reputation: 122

Like
Likes
Like

Posted 07 August 1999 - 06:53 PM

That's the simplest and most efficient way to do it, but there's a caveat...

Perhaps sounds obvious, but I've seen people caught out before... make sure that your string (OhYes in the example above) has room for the entire integer _and_ the trailing null.

The best you can hope for if you don't is a seg-fault

White Fire


#4 Slide   Members   -  Reputation: 122

Like
Likes
Like

Posted 10 August 1999 - 10:05 AM

and dont forget displaying the fps drops the fps

if its for development work i'd store it all in some ram structure then dump to textfile for better readings


#5 NuFAN   Members   -  Reputation: 122

Like
Likes
Like

Posted 10 August 1999 - 11:28 AM

You could also try :

TextOut(hdc, 20, 20, FloatToStr(fps).c_str(), sizeof(FloatToStr(fps).c_str()));

This should also work and is just one line of code.

------------------
Skullpture Entertainment
#40842461


#6 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 11 August 1999 - 06:13 PM

You could always do what I did.

Draw a BMP full of numbers..you know..your own fonts.

Then take the FPS counter.. and run it through a loop that checks each number and blits the correct font from the bmp onto the screen..

And you dont have to deal with TextOut


-DL





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS