[SDL] Setting FPS to 60?
Leo Cabrera
leo28c at gmail.com
Tue Mar 20 07:48:59 PDT 2007
Nevermind, I found a better approach.
Thanks though.
On 3/19/07, L-28C <kixdemp at gmail.com> wrote:
>
> Hello everyone!
>
> I'm translating a piece of code into C#. However it has some variables
> and functions that who-knows-where they are declared, so if anyone could
> analyze my framerate function I would appreciate it: (translated back to
> C++ and regular SDL 'cause I know most of you guys don't speak C#)
>
> void waitVblankStart()
> {
> float t = ((float) SDL_GetTicks()) / ((float) 60);
> if (t - lastTime < 1.0/60.0)
> {
> SDL_Delay(int)(1000000000.0 * (1.0 / 60.0 - (t -
> lastTime))));
> }
> // lastTime is a global, and 2,000,000 stands for 2.0GHz How do I
> get
> the actual processor cycles-per-second in SDL?
> lastTime = ((float) SdlDotNet.Core.Timer.TicksElapsed) / ((float)
> 2000000);
>
> printf(lastTime); // assume printf() can print floats
> }
>
> Thanks in advance!
>
> _______________________________________________
> SDL mailing list
> SDL at lists.libsdl.org
> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20070320/7115ab2e/attachment.html
More information about the SDL
mailing list