• Advertisement

Archived

This topic is now archived and is closed to further replies.

Printing FPS

This topic is 5832 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi I created a function which receives a string then print it to the screen . I want to print my FPS which is not a string ,it is of type "int" how can I solve that ? thanx in advance

Share this post


Link to post
Share on other sites
Advertisement
mate this is probably a general probramming q. but hey...
your fps is of int (I'd personally use a float but hey again...)
you want to make it a string.
try this (in C-style)

    
#include <stdio.h>

#include <string.h>

int fps;
char buffer[80]; // 80 is just a relic of having old DOS / UNIX

// style displays which had 80 columns but

//you can use a smaller number if you like


// get the fps somewhere here and store it in fps


// now take the fps and put it inside your string

sprintf(buffer,"%d",fps);
// buffer now holds the string which is a character

// representation of the fps

// call your function which outputs text to the screen

DrawText(x,y,buffer); // or whatever your function is



If you're C++ minded then just use the << operator which works on the base datatypes.





Edited by - tobymurray on February 2, 2002 10:30:20 AM

Edited by - tobymurray on February 2, 2002 10:31:17 AM

Share this post


Link to post
Share on other sites

  • Advertisement