Frames
Hi!
How can I draw the Fps with my font-engine and this function:
float Fps = 0.0f;
char strFr = {0};
...
void CalculateFps()
{
static float LastTime = 0.0f;
static char strFr = {0};
float CurrentTime = GetTickCount() * 0.001f;
++Fps;
if(CurrentTime-LastTime>1.0f)
{
LastTime=CurrentTime;
Fps=0;
}
}
sprintf(a_string,"framerate : %f",fps);
Now use your font engine to print a_string to the screen.
"THE INFORMATION CONTAINED IN THIS REPORT IS CLASSIFIED; DO NOT GO TO FOX NEWS TO READ OR OBTAIN A COPY." , the pentagon
He just did post the code.
Alex Broadwin
A-Tronic Software & Design
-----
"if you fail in life, you were destined to fail. If you suceed in life, call me."
"The answer is out there."
"Please help, I''m using Windows!"
Alex Broadwin
A-Tronic Software & Design
-----
"if you fail in life, you were destined to fail. If you suceed in life, call me."
"The answer is out there."
"Please help, I''m using Windows!"
Alex BroadwinA-Tronic Software & Design-----"if you fail in life, you were destined to fail. If you suceed in life, call me.""The answer is out there.""Please help, I'm using Windows!"
I mean that he should post the code with which i could draw the text with the font engine
Er, isn''t it YOUR font engine? I''ll give you an example though. If you normally use:
PrintText("sample")
(not a real function, just an example)
Then you would change it to:
PrintText(a_string);
Get it?
Alex Broadwin
A-Tronic Software & Design
-----
"if you fail in life, you were destined to fail. If you suceed in life, call me."
"The answer is out there."
"Please help, I''m using Windows!"
PrintText("sample")
(not a real function, just an example)
Then you would change it to:
PrintText(a_string);
Get it?
Alex Broadwin
A-Tronic Software & Design
-----
"if you fail in life, you were destined to fail. If you suceed in life, call me."
"The answer is out there."
"Please help, I''m using Windows!"
Alex BroadwinA-Tronic Software & Design-----"if you fail in life, you were destined to fail. If you suceed in life, call me.""The answer is out there.""Please help, I'm using Windows!"
quote:
char strFr = {0};
I'd change that to char strFr[20]; for starters.
You don't need to set it to anything, sprintf will replace what ever you put anyway, but I'm glad that you understand how strings work!
[EDIT:]
For safety, you should use snprintf(char *s, size_t size, const char *template, ...) , for example, snprintf(strFr, sizeof(strFr), "FPS: %.2f", fps); . This will keep you from accidently overflowing the buffer.
Edited by - smart_idiot on March 5, 2002 12:57:44 PM
Chess is played by three people. Two people play the game; the third provides moral support for the pawns. The object of the game is to kill your opponent by flinging captured pieces at his head. Since the only piece that can be killed is a pawn, the two armies agree to meet in a pawn-infested area (or even a pawn shop) and kill as many pawns as possible in the crossfire. If the game goes on for an hour, one player may legally attempt to gouge out the other player's eyes with his King.
quote:
Original post by Gnomo
I mean that he should post the code with which i could draw the text with the font engine
In your font engine, do you have a function to print string''s to the screen ?
If so use it, if not, you don''t have a font engine.
Gnomo, looking at your profile, do you even understand basic C/C++ ?
"THE INFORMATION CONTAINED IN THIS REPORT IS CLASSIFIED; DO NOT GO TO FOX NEWS TO READ OR OBTAIN A COPY." , the pentagon
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement