my ( $w, $h ) = ( 800, 480 );
my $mouse_trashold = 10;
+my $max_path_length = 200;
our $app = SDL::App->new(
-width => $w,
my ( $last_x, $last_y ) = ( 0,0 );
-my $max_path_length = 100;
my @path;
sub curve {
+ return unless $#path > 4;
my $curve = Math::CatmullRom->new( splice @path, 0, $#path + $#path / 2 );
- my @curve = $curve->curve( $mouse_trashold * $max_path_length );
+ my @curve = $curve->curve( $mouse_trashold * $max_path_length / 2 );
warn "curve ", dump @curve;
my $i = 0;
} elsif ( $type == SDL_MOUSEBUTTONUP() ) {
warn "mouse up ", $event->button_x, ' ', $event->button_y;
$mouse_down = 0;
+ curve;
} elsif ( $type == SDL_QUIT() ) {
exit;
} elsif ( $type == SDL_KEYDOWN() ) {
$last_y = $y;
} else {
$mouse_down = 0;
+ curve;
}
}
} else {