Permalink
Browse files

Don't store starting points, add ending points

  • Loading branch information...
1 parent 6fef671 commit bc145571a8ba79e7d8b48ba697b84e01cd99d482 @jtpalmer committed Mar 28, 2011
Showing with 10 additions and 9 deletions.
  1. +10 −9 week4/lib/Games/ElectricLines.pm
View
19 week4/lib/Games/ElectricLines.pm
@@ -29,13 +29,6 @@ has _sprite => (
builder => '_build_sprite',
);
-has _starting_points => (
- is => 'ro',
- isa => 'ArrayRef',
- lazy => 1,
- builder => '_build_starting_points',
-);
-
has _horizontal_lines => (
is => 'ro',
isa => 'ArrayRef',
@@ -96,12 +89,16 @@ sub _build_sprite {
return $sprite;
}
-sub _build_starting_points {
+sub _starting_points {
my ($self) = @_;
-
return [ map { $_->[0] } @{ $self->_horizontal_lines } ];
}
+sub _ending_points {
+ my ($self) = @_;
+ return [ map { $_->[1] } @{ $self->_horizontal_lines } ];
+}
+
sub _build_horizontal_lines {
my ($self) = @_;
@@ -197,6 +194,10 @@ sub handle_show {
$app->draw_circle_filled( $start, $radius, 0xFFFFFFFF );
}
+ foreach my $start ( @{ $self->_ending_points } ) {
+ $app->draw_circle_filled( $start, $radius, 0xFFFFFFFF );
+ }
+
if ( $self->_has_active_line() ) {
$self->_draw_active_line( $self->_active_line );
}

0 comments on commit bc14557

Please sign in to comment.