You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
893 B
39 lines
893 B
use v5.36;
|
|
use rlib '..';
|
|
|
|
use HexGrid;
|
|
use HexGrid::Path;
|
|
|
|
use Carp;
|
|
|
|
use Data::Dumper;
|
|
|
|
my $MAP_SIZE = 3;
|
|
|
|
my $grid = HexGrid->new(defaults => {
|
|
style => { 'stroke-width' => 1, stroke => 'white' },
|
|
show_coords => 0});
|
|
my $region = $grid->make_region("TEST");
|
|
|
|
for (my $nw=-$MAP_SIZE; $nw <= $MAP_SIZE; $nw++)
|
|
{
|
|
for (my $sw=-$MAP_SIZE; $sw <= $MAP_SIZE; $sw++)
|
|
{
|
|
$region->make_tile_at($nw, $sw);
|
|
}
|
|
}
|
|
|
|
$grid->make_path_from('test-id',
|
|
[[0,0], [1,0], [1,1], [2,0], [2,-1], [2,-2], [1,-2], [1,-1], [2,-1], [3,-1]],
|
|
colour => 'lime', css_class => 'path', style => { 'stroke-width' => 5 }
|
|
);
|
|
$grid->make_path_from('point-id', [[-1,1]],
|
|
colour => 'cyan', css_class => 'path', style => { 'stroke-width' => 5 }
|
|
);
|
|
$grid->make_path_from('loop-id',
|
|
[[-2,0], [-1,0], [-1,-1], [-2,-1], [-2,0]],
|
|
colour => 'red', css_class => 'path', style => { 'stroke-width' => 5 }
|
|
);
|
|
|
|
|
|
say $grid->render;
|
|
|