6 use SDL::Tool::Graphic;
9 my ( $class, $app ) = @_;
22 $self->{path} = [ @_ ];
23 $self->{path_position} = 0;
24 $self->{tick} = $self->{app}->ticks + $self->{speed};
27 my $tool = SDL::Tool::Graphic->new;
31 return unless $self->{tick};
32 if ( $self->{app}->ticks > $self->{tick} ) {
33 my $pos = $self->{path_position} += 2;
34 if ( $pos > $#{ $self->{path} } ) {
35 warn "end of path for $self";
39 my $to = SDL::Rect->new(
40 -x => $self->{path}[$pos],
41 -y => $self->{path}[$pos+1],
43 # $plane->blit( $plane->rect, $self->{app}, $to );
46 $self->{path}[$pos+1] - $self->{path}[$pos+3],
47 $self->{path}[$pos] - $self->{path}[$pos+2],
49 my $deg = $radian / 3.1459265 * 180;
51 $deg = -$deg + 90; # plain nose at 90 deg.
53 my $plane = SDL::Surface->new( -name => 'artwork/airplane.png' );
54 my $rotated = $tool->rotoZoom( $plane, $deg, 1, 1 );
55 $rotated->blit( $rotated->rect, $self->{app}, $to );
57 warn "$pos $radian $deg ", $rotated->width, ' ', $rotated->height;
58 $self->{tick} = $self->{app}->ticks + $self->{speed};