How abouts would I go to get the fps using SDL?
If you need more information, please do ask.
Thanks in advance.
Salvenger
SDL get FPS (C#)
Your FPS is the inverse of the time elapsed between this frame and the last frame. SDL_GetTicks() gives you the current timestamp, in milliseconds. Go from there.
Sorry I don't know C# but generally you need to
-choose how often you want to poll fps
-get an initial time variable T0
-increment a frame counter after every render
-assign SDL_GetTicks() to a current time variable t
-check the time passed (t - T0)
if it is greater than the polling time you chose, FPS is just the frames divided by time passed in seconds ( / 1000 because SDL_GetTicks is in ms): that is FPS = frames/((t-T0) / 1000).
-when that is calculated, do whatever you want with your FPS value, set T0 = t and frames = 0
i'm not sure where i got this from, i think it's from a nehe tutorial maybe, i found the same code i'm using in another thread on here
-choose how often you want to poll fps
-get an initial time variable T0
-increment a frame counter after every render
-assign SDL_GetTicks() to a current time variable t
-check the time passed (t - T0)
if it is greater than the polling time you chose, FPS is just the frames divided by time passed in seconds ( / 1000 because SDL_GetTicks is in ms): that is FPS = frames/((t-T0) / 1000).
-when that is calculated, do whatever you want with your FPS value, set T0 = t and frames = 0
i'm not sure where i got this from, i think it's from a nehe tutorial maybe, i found the same code i'm using in another thread on here
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement