Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Don't store starting points, add ending points

  • Loading branch information...
commit bc145571a8ba79e7d8b48ba697b84e01cd99d482 1 parent 6fef671
Jeffrey T. Palmer authored
Showing with 10 additions and 9 deletions.
  1. +10 −9 week4/lib/Games/ElectricLines.pm
19 week4/lib/Games/ElectricLines.pm
View
@@ -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 );
}
Please sign in to comment.
Something went wrong with that request. Please try again.