projects
/
perl-landing-airplanes.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
2123ea5
)
make curve and implementation separate
author
Dobrica Pavlinusic
<dpavlin@rot13.org>
Fri, 21 May 2010 15:37:33 +0000
(17:37 +0200)
committer
Dobrica Pavlinusic
<dpavlin@rot13.org>
Fri, 21 May 2010 15:37:33 +0000
(17:37 +0200)
trace-path.pl
patch
|
blob
|
history
diff --git
a/trace-path.pl
b/trace-path.pl
index
0fe9353
..
202f8ac
100755
(executable)
--- a/
trace-path.pl
+++ b/
trace-path.pl
@@
-124,9
+124,7
@@
my ( $last_x, $last_y ) = ( 0,0 );
our @path;
sub reset_path { @path = () }
our @path;
sub reset_path { @path = () }
-sub curve {
-
- push @path, lading_points( $path[-2], $path[-1] ) if $#path > 1;
+sub curve_catmull_rom {
if ( $#path < ( 4 * 2 - 1 ) ) { # less than 4 points
warn "path too short ", dump @path;
if ( $#path < ( 4 * 2 - 1 ) ) { # less than 4 points
warn "path too short ", dump @path;
@@
-155,6
+153,18
@@
sub curve {
reset_path;
}
reset_path;
}
+sub curve {
+ # add landing path points
+ push @path, lading_points( $path[-2], $path[-1] ) if $#path > 1;
+
+ if ( 1 ) {
+ curve_catmull_rom;
+ } else {
+
+ }
+
+}
+
sub clear_screen {
my ( $mask ) = @_;
reset_path;
sub clear_screen {
my ( $mask ) = @_;
reset_path;
@@
-180,7
+190,6
@@
sub handle_events {
} elsif ( $type == SDL_MOUSEBUTTONUP() ) {
debug 'mouse up', $event->button_x, $event->button_y;
$mouse_down = 0;
} elsif ( $type == SDL_MOUSEBUTTONUP() ) {
debug 'mouse up', $event->button_x, $event->button_y;
$mouse_down = 0;
-
curve;
} elsif ( $type == SDL_QUIT() ) {
exit;
curve;
} elsif ( $type == SDL_QUIT() ) {
exit;