| 1 | ########################################################################## | ||
| 2 | package Games::PangZero::FpsIndicator; | ||
| 3 | ########################################################################## | ||
| 4 | |||
| 5 | @ISA = qw(Games::PangZero::GameObject); | ||
| 6 | |||
| 7 | sub new { | ||
| 8 | my ($class) = @_; | ||
| 9 | my $self = Games::PangZero::GameObject->new(); | ||
| 10 | my $width = Games::PangZero::Graphics::TextWidth("999"); | ||
| 11 | %{$self} = ( %{$self}, | ||
| 12 | 'x' => $Games::PangZero::ScreenWidth - $width + $Games::PangZero::ScreenMargin, | ||
| 13 | 'y' => -$Games::PangZero::ScreenMargin, | ||
| 14 | 'w' => $width, | ||
| 15 | 'h' => 32, | ||
| 16 | ); | ||
| 17 | |||
| 18 | $self->TransferRect(); | ||
| 19 | bless $self, $class; | ||
| 20 | } | ||
| 21 | |||
| 22 | sub Draw { | ||
| 23 | my $self = shift; | ||
| 24 | |||
| 25 | SDLx::SFont::print_text( $Games::PangZero::App, $self->{rect}->x, $self->{rect}->y, Games::PangZero::GameTimer::GetFramesPerSecond() ); | ||
| 26 | |||
| 27 | } | ||
| 28 | |||
| 29 | 1; |