parent cf59c89cf2
commit 7fa72aef52
  1. 13
      HexGrid.pm
  2. 11
      HexGrid/Region.pm

@ -120,6 +120,19 @@ sub subgrid_for_tiles($this, @coords_list)
return $subgrid; return $subgrid;
} }
sub iter_region($this, $code)
{
foreach my $region (values %{$this->{regions}})
{
$code->($region);
}
}
sub iter_tile($this, $code)
{
$this->iter_region(sub($region) { $region->iter_tile($code) });
}
sub render($this) sub render($this)
{ {
my ($min_x,$min_y,$max_x,$max_y) = qw(Inf Inf -Inf -Inf); my ($min_x,$min_y,$max_x,$max_y) = qw(Inf Inf -Inf -Inf);

@ -42,6 +42,17 @@ sub make_subregion($this, $name, %defaults)
$this->add_subregion(HexGrid::Region->new(name => $name, defaults => $tile_defaults)); $this->add_subregion(HexGrid::Region->new(name => $name, defaults => $tile_defaults));
} }
sub iter_tile($this, $code)
{
foreach my $nw (keys %{$this->{tiles}})
{
foreach my $sw (keys %{$this->{tiles}{$nw}})
{
$code->($this->{tiles}{$nw}{$sw});
}
}
}
sub render($this, $svg, $laters, $grid) sub render($this, $svg, $laters, $grid)
{ {
my ($min_x,$min_y,$max_x,$max_y) = qw(Inf Inf -Inf -Inf); my ($min_x,$min_y,$max_x,$max_y) = qw(Inf Inf -Inf -Inf);

Loading…
Cancel
Save