Codebase list pangzero / upstream/latest lib / Games / PangZero / FpsIndicator.pm
upstream/latest

Tree @upstream/latest (Download .tar.gz)

FpsIndicator.pm @upstream/latestraw · history · blame

##########################################################################
package Games::PangZero::FpsIndicator;
##########################################################################

@ISA = qw(Games::PangZero::GameObject);

sub new {
  my ($class) = @_;
  my $self    = Games::PangZero::GameObject->new();
  my $width   = Games::PangZero::Graphics::TextWidth("999");
  %{$self}    = ( %{$self},
    'x' => $Games::PangZero::ScreenWidth - $width + $Games::PangZero::ScreenMargin,
    'y' => -$Games::PangZero::ScreenMargin,
    'w' => $width,
    'h' => 32,
  );
  
  $self->TransferRect();
  bless $self, $class;
}

sub Draw {
  my $self = shift;
  
  SDLx::SFont::print_text( $Games::PangZero::App, $self->{rect}->x, $self->{rect}->y, Games::PangZero::GameTimer::GetFramesPerSecond() );

}

1;