Permalink
Browse files

Refactor fps

  • Loading branch information...
1 parent 626311c commit 10a105a8acbda4ff4867c8c7278bb9863ee93a44 @jtpalmer committed Aug 21, 2011
Showing with 6 additions and 5 deletions.
  1. +6 −5 examples/test.pl
View
11 examples/test.pl
@@ -8,9 +8,10 @@
my $app = SDLx::App->new();
+my $fps = 30;
+
my $controller = SDLx::Controller::FPS->new(
- fps => 15,
- move_ratio => 2,
+ fps => $fps,
eoq => 1,
);
@@ -32,15 +33,15 @@
my $key = SDL::Events::get_key_name( $event->key_sym );
if ( $key eq '1' ) {
- $controller->fps(30);
+ $controller->fps($fps);
$controller->move_ratio(1);
}
elsif ( $key eq '2' ) {
- $controller->fps(15);
+ $controller->fps($fps / 2);
$controller->move_ratio(2);
}
elsif ( $key eq '3' ) {
- $controller->fps(10);
+ $controller->fps($fps / 3);
$controller->move_ratio(3);
}
}

0 comments on commit 10a105a

Please sign in to comment.