File Coverage

blib/lib/SDLx/FPS.pm
Criterion Covered Total %
statement 25 26 96.1
branch 2 2 100.0
condition n/a
subroutine 9 9 100.0
pod 4 4 100.0
total 40 41 97.5


line stmt bran cond sub pod time code
1             package SDLx::FPS;
2 2     2   1413 use strict;
  2         3  
  2         48  
3 2     2   7 use warnings;
  2         5  
  2         39  
4 2     2   345 use SDL::GFX::Framerate;
  2         4  
  2         77  
5 2     2   347 use SDL::GFX::FPSManager;
  2         4  
  2         97  
6 2     2   10 use Carp;
  2         4  
  2         588  
7             our @ISA = qw(SDL::GFX::FPSManager);
8              
9             our $VERSION = 2.548;
10              
11             sub new {
12 2     2 1 582 my ( $class, %args ) = @_;
13              
14 2         7 for ( grep { $_ ne 'fps' } keys %args ) {
  1         5  
15 0         0 Carp::cluck("Unrecognized constructor hash key: $_");
16             }
17 2         12 my $fps = $class->SDL::GFX::FPSManager::new( 0, 0, 0, 0 );
18 2         19 SDL::GFX::Framerate::init( $fps );
19 2 100       10 $fps->set( $args{fps} ) if defined $args{fps};
20 2         8 $fps;
21             }
22              
23             sub set {
24 2     2 1 809 SDL::GFX::Framerate::set( @_[ 0, 1 ] );
25             }
26              
27             sub get {
28 3     3 1 307 SDL::GFX::Framerate::get( $_[0] );
29             }
30              
31             sub delay {
32 11     11 1 1996329 SDL::GFX::Framerate::delay( $_[0] );
33             }
34              
35             1;
36              
37             __END__