Hi again! xD… my game’s progressing awesomely thanks to all of you
hehe… o.o but now I wonder xD I’ve been through google, lazy foo’s
tutorials, Aaron’s SDL tutorials, and such, searching for an FPS counter
code and I haven’t found any, and in lazy foo’s site the code is too old and
it throws errors in SDL (it uses “timers”? which I supposed SDL had =/ ).
Going through google all I can find are pseudo-codes and theories, but no
example whatsoever :(. Does anybody here has a simple FPS counter that can
share please? ^^…
Thursday, September 14, 2006, 6:24:53 PM, you wrote:
Hi again! xD… my game’s progressing awesomely thanks to all of you
hehe… o.o but now I wonder xD I’ve been through google, lazy foo’s
tutorials, Aaron’s SDL tutorials, and such, searching for an FPS counter
code and I haven’t found any, and in lazy foo’s site the code is too old and
it throws errors in SDL (it uses “timers”? which I supposed SDL had =/ ).
Going through google all I can find are pseudo-codes and theories, but no
example whatsoever :(. Does anybody here has a simple FPS counter that can
share please? ^^…
It’s quite easy:
while (gamerunning)
{
Uint32 start_time, frame_time;
float fps;
The extra bit in the fps calculation stops a divide by zero should a
frame happen to take less than a millisecond (it’s not likely, but it
can happen)–
Best regards,
Peter mailto:@Peter_Mulholland
o.o yay! that works prefectly! yeah, I heard about there could be some
divide-by-zero errors but no way how to avoid that one either, now I’m
getting the hang of it too, thanks! :DOn 9/14/06, Peter Mulholland wrote:
Hello DARKGuy,
Thursday, September 14, 2006, 6:24:53 PM, you wrote:
Hi again! xD… my game’s progressing awesomely thanks to all of you
hehe… o.o but now I wonder xD I’ve been through google, lazy foo’s
tutorials, Aaron’s SDL tutorials, and such, searching for an FPS counter
code and I haven’t found any, and in lazy foo’s site the code is too old
and
it throws errors in SDL (it uses “timers”? which I supposed SDL had =/
).
Going through google all I can find are pseudo-codes and theories, but
no
example whatsoever :(. Does anybody here has a simple FPS counter that
can
share please? ^^…
It’s quite easy:
while (gamerunning)
{
Uint32 start_time, frame_time;
float fps;
o.o yay! that works prefectly! yeah, I heard about there could be
some divide-by-zero errors but no way how to avoid that one either, now
I’m getting the hang of it too, thanks!
Well, that division by zero might happen if your video card is able to
draw so fast the pc records zero time difference. It might happen more
frequently if you’re using an imprecise method such as using a timer
that produces a number of .1 seconds, etc…
And if it’s because of the hardware being too fast, can you tell me your
supplier?
Hi again! xD… my game’s progressing awesomely thanks to all of you
hehe… o.o but now I wonder xD I’ve been through google, lazy foo’s
tutorials, Aaron’s SDL tutorials, and such, searching for an FPS counter
code and I haven’t found any, and in lazy foo’s site the code is too old
and it throws errors in SDL (it uses “timers”? which I supposed SDL had
=/ ). Going through google all I can find are pseudo-codes and theories,
but no example whatsoever :(. Does anybody here has a simple FPS counter
that can share please? ^^…
Cool. I was just about to post this question, and then I find out it has
already been posted and answered! =DOn 9/15/06, Peter Mulholland wrote:
Hello DARKGuy,
Thursday, September 14, 2006, 6:24:53 PM, you wrote:
Hi again! xD… my game’s progressing awesomely thanks to all of you
hehe… o.o but now I wonder xD I’ve been through google, lazy foo’s
tutorials, Aaron’s SDL tutorials, and such, searching for an FPS counter
code and I haven’t found any, and in lazy foo’s site the code is too old
and
it throws errors in SDL (it uses “timers”? which I supposed SDL had =/
).
Going through google all I can find are pseudo-codes and theories, but
no
example whatsoever :(. Does anybody here has a simple FPS counter that
can
share please? ^^…
It’s quite easy:
while (gamerunning)
{
Uint32 start_time, frame_time;
float fps;
Thursday, September 14, 2006, 6:24:53 PM, you wrote:
Hi again! xD… my game’s progressing awesomely thanks to all of you
hehe… o.o but now I wonder xD I’ve been through google, lazy foo’s
tutorials, Aaron’s SDL tutorials, and such, searching for an FPS
counter
code and I haven’t found any, and in lazy foo’s site the code is too
old and
it throws errors in SDL (it uses “timers”? which I supposed SDL had =/
).
Going through google all I can find are pseudo-codes and theories, but
no
example whatsoever :(. Does anybody here has a simple FPS counter that
can
share please? ^^…
It’s quite easy:
while (gamerunning)
{
Uint32 start_time, frame_time;
float fps;