SDLx::FPS(3pm)

SDLx::FPS3pm

A more convenient way to set a framerate

Usage

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

Overview

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.

Methods

new

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

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

set

 $fps->set($new_framerate);

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

get

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

delay

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.

framecount

Return the "framecount".

rateticks

Return the "rateticks".

lastticks

Return the "lastticks".

rate

Return the "rate".

Releases

7 releases since Debian 7 (Wheezy); the text changed 6 times.

  1. 7
  2. 8
  3. 9
  4. 10
  5. 11
  6. 12
  7. 13

Authors

See "AUTHORS" in SDL.

From libsdl-perl 2.548-5+b1 in Debian 13 (Trixie). Parsed by carta from the page's man source.