GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
SDLx::FPS(3) User Contributed Perl Documentation SDLx::FPS(3)

SDLx::FPS - a more convenient way to set a framerate

 use SDLx::FPS;
 my $fps = SDLx::FPS->new(fps => 60);
 while(1) { # Main game loop
     # Do game related stuff

     $fps->delay;
 }

SDLx::FPS simplifies the task of giving your game a framerate. Basically, it combines the methods of "SDL::GFX::Framerate" and "SDL::GFX::FPSManager" into a single module. Use it to delay the main loop to keep it at a specified framerate.

 my $fps = SDLx::FPS->new( fps => 30 );

No arguments are required, if no "fps" is specified, the default FPS is 30.

 $fps->set($new_framerate);

Same as "SDL::GFX::Framerate::set". Set the new desired framerate.

Same as "SDL::GFX::Framerate::get". Get the currently set framerate.

Same as "SDL::GFX::Framerate::delay". Generate a delay to accommodate currently set framerate. Call once in the graphics/rendering loop. If the computer cannot keep up with the rate (i.e. drawing too slow), the delay is 0 and the delay interpolation is reset.

Return the "framecount".

Return the "rateticks".

Return the "lastticks".

Return the "rate".

See "AUTHORS" in SDL.

SDL::GFX::Framerate, SDL::GFX::FPSManager
2022-06-07 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.