Skip to content
Browse files

tweener app ref is now weak

  • Loading branch information...
1 parent d006395 commit 454f5ecb765cf74792fe78e9a0cc79bc6cd43214 @eilara committed May 27, 2012
Showing with 9 additions and 4 deletions.
  1. +2 −1 TODO
  2. +1 −1 eg/08-sprite.pl
  3. +6 −2 lib/SDLx/Betweener.pm
View
3 TODO
@@ -20,7 +20,8 @@ TODO
- delay tween, there just for delaying until completion event
- add spawner non-linear ease
- seeker direct target should be weak ref and add target dead event
- - some way to get int tween to clamp when floored for sprite tweens
+ - some way to get int tween to clamp when floored for sprite tweens,
+ add clamp arg to int tween and probably round arg
* Proxy decorators
- SDLx::Rect proxy for 2D paths
- face angle for path tweens
View
2 eg/08-sprite.pl
@@ -40,7 +40,7 @@ sub _build_sequences {
sub _build_walk_tween {
my $self = shift;
return $self->tweener->tween_int(
- t => 500,
+ t => 2000,
range => [0, $self->frame_count],
on => {set_frame => $self},
forever => 1,
View
8 lib/SDLx/Betweener.pm
@@ -53,12 +53,16 @@ sub new {
my ($class, %args) = @_;
my $timeline = SDLx::Betweener::Timeline->new;
my $move_handler = sub { $timeline->tick };
- $args{app}->add_move_handler($move_handler) if $args{app};
- return bless {
+ my $app = delete $args{app};
+ $app->add_move_handler($move_handler) if $app;
+ my $self = bless {
timeline => $timeline,
move_handler => $move_handler,
+ app => $app,
%args,
}, $class;
+ weaken $self->{app};
+ return $self;
}
sub DESTROY {

0 comments on commit 454f5ec

Please sign in to comment.
Something went wrong with that request. Please try again.