Jump to content
  • Advertisement


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



This topic is 6943 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

What does this actually return .. it returns 1 or 2 if printed out. Since the Timer has been changed in Pr306 how do I get the fps?

Share this post

Link to post
Share on other sites
Hi Nat

According to the info from the pr.chm the HTML help file:

Returns the time passed
Declaration: PR_DWORD PR_GetTicks (void)
Remarks: This routine will return the number of ticks passed since the last time you called it. This can be used as a multiplier in all your object movements so they move the same speed regardless of the CPU or 3D card you use.
Parameters: None
Return Value: Ticks passed since last call
See Also: PR_InitTimer

Usually in your code the PR_GetTicks function is used like

move_count = PR_GetTicks();
You then take this move_count and mulitply it by
all the movement varibles such as rotation and translation
to get a consistent frame rate.

I used this function to get consistent frame rates by using
this function. Usually without using this function you will
get higher than nomal frame rates but without the consistent frame rates. As an example a simple cube would give a high FPS count while an object such as a high face count like a sphere would give you a lower frame rate. Using the PR_GetTick function you will get a more consistent frame rates when moving about your scene. There will be some variances from the target frame rate thats set using the PR_InitTimer function, but you will not get those wide frame rate swings without using the PR_GetTicks function.

As for a frame rate counter you could use something like this:

This is the include file:

These are the varibles I used:
clock_t time = 0, timelast = 0;
PR_DWORD frame = 0, count = 0;

// Used to display Frame Rate
time = clock(); // Standard C timer function
if(time - timelast >= 1000)
frame = count;
timelast = time;
count = 0;
PRGUI_printf(15,160,"FPS: %d", frame);

There is however two functions that uses the PR_GetTicks function that is from the land1.c file that displays FPS:

void ResetFPS (void)
updates = 0;
ticks = 0;

brightcolor = PRGFX_MakeColor (63, 63, 63);
darkcolor = PRGFX_MakeColor (0, 0, 0);

void ShowFPS (PR_DWORD move_count)
ticks += move_count;

/* Calculate the frame rate */
if (ticks > 60)
framerate = updates;
ticks = 0;
updates = 0;

PRGFX_Clip (0,0, vwidth-1, vheight-1);
PRGFX_SetTextForeground (brightcolor);
PRGFX_SetTextBackground (darkcolor);
PRGFX_SetTextTransparent (TEXTFGBG);
PRGUI_printf (vwidth - 30, 2, "%i", framerate);

Hope this helps

Edited by - sovereign on 4/14/00 3:28:11 PM

Edited by - Sovereign on 4/14/00 3:31:38 PM

Edited by - Sovereign on 4/14/00 3:35:17 PM

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!