diff --git a/parse-regions.pl b/parse-regions.pl deleted file mode 100644 index 6c894cd..0000000 --- a/parse-regions.pl +++ /dev/null @@ -1,82 +0,0 @@ -use v5.30; - -use HexGrid; -use Carp; -use Data::Dumper; - -my $grid = HexGrid->new(defaults => { style => { 'stroke-width' => 1, 'stroke' => 'black' }, show_coords => 1 }); - -$grid->make_region("Viper's Gate", colour => 'red'); -my $adderwall = $grid->make_region('Adderwall', colour => 'orange'); -# $adderwall->make_subregion('Adderwall foothills', colour => 'moccasin'); -$grid->make_region('Adderwall foothills', colour => 'moccasin'); -$grid->make_region('Midhills', colour => 'moccasin'); -# $grid->make_region('Minev', colour => 'green', images => ["forest-tile.png"]); -$grid->make_region('Minev', colour => 'green'); -$grid->make_region('Barrowcross', colour => 'darkgreen'); -$grid->make_region('Shinei Mavet', colour => 'orange'); -$grid->make_region('Jagged Shinei Mavet', colour => 'orange'); -$grid->make_region('Shinei Mavet waters', colour => 'lightcyan'); -# $grid->make_region('Shinei Mavet', colour => 'orange', image => 'mountain.svg'); -# $grid->make_region('Jagged Shinei Mavet', colour => 'orange', images => ['mountain.svg', 'jagged.svg']); -# $grid->make_region('Shinei Mavet waters', colour => 'lightcyan', image => 'foo.png'); -$grid->make_region('Southern Ocean', colour => 'skyblue'); -$grid->make_region('A volcano', colour => 'orange'); -$grid->make_region('Buslish Scrubs', colour => 'beige'); -$grid->make_region('The Blasted Metropolis', colour => 'gray'); -$grid->make_region('The sprawling grasses', colour => 'beige'); -$grid->make_region('Something sandy?', colour => 'navajowhite'); -$grid->make_region('Necromancer', colour => 'orange'); -$grid->make_region('The Narrow Sea', colour => 'skyblue'); -$grid->make_region('Naurardhon', colour => 'palegoldenrod'); -$grid->make_region('The Glades of Leamingbury', colour => 'lightgreen'); -$grid->make_region('Cape of Lost Causes', colour => 'gray'); -$grid->make_region('Deadlands', colour => 'black'); -$grid->make_region('Deadlands', colour => 'black'); -$grid->make_region('Glade borders', colour => 'mediumaquamarine'); -$grid->make_region('Thicket', colour => 'darkgreen'); -$grid->make_region('Random house', colour => 'darkgreen'); -$grid->make_region('Abbey of Plendor', colour => 'beige'); -$grid->make_region('Khulanu', opacity => '0', style => { 'stroke-width' => 5, 'stroke' => 'black' }); - -my $tiles; -open $tiles, "$ENV{HOME}/RPG-stuff/WestOfVipers/coordinate-mapping"; - -my $region; -my $region_file; -start_region(); -while(my $coords = <$tiles>) -{ - if ($coords =~ /^\s*$/) - { - start_region(); - next; - } - print $region_file $coords if $coords; -} -close $region_file if $region_file; - -sub start_region -{ - close $region_file if $region_file; - $region = <$tiles>; - chomp($region); - my $encoded_region = $region; - $encoded_region =~ s/\W/_/g; - open $region_file, ">region_files/$encoded_region" || croak "Can't open file for $region: $!"; - say $region_file "== Style =="; - foreach my $key (keys %{$grid->{regions}{$region}{defaults}}) - { - next if $key eq 'style'; - say $region_file "$key: $grid->{regions}{$region}{defaults}{$key}"; - } - if(my $css = $grid->{regions}{$region}{defaults}{style}) - { - say $region_file "\n=== CSS ==="; - foreach my $key (keys %{$grid->{regions}{$region}{defaults}{style}}) - { - say $region_file "$key: $grid->{regions}{$region}{defaults}{style}{$key}"; - } - } - say $region_file "\n== Tiles =="; -} diff --git a/popup.pl b/popup.pl deleted file mode 100644 index 561c42c..0000000 --- a/popup.pl +++ /dev/null @@ -1,37 +0,0 @@ -use v5.30; - -# use Getopt::Long; -use SVG; - -my $width = 400; -my $height = 300; -my $origin_x = 0; -my $origin_height = 100; -my $corner_radius = 25; -my $gap_start = 50; -my $gap_width = 50; - -my $full_height = $height + $origin_height; - -my $svg = SVG->new(width => $width, height => $full_height, viewBox => "0 0 $width $full_height"); - -my $path_string = "M $gap_start,$height"; -$path_string .= L($origin_x,$full_height); -$path_string .= L($gap_start + $gap_width,$height); -$path_string .= L($width - $corner_radius, $height); -$path_string .= a($corner_radius, $corner_radius, 0, 0, 0, $corner_radius, -$corner_radius); -$path_string .= l(0, -($height - 2*$corner_radius)); -$path_string .= a($corner_radius, $corner_radius, 0, 0, 0, -$corner_radius, -$corner_radius); -$path_string .= l(-($width - 2*$corner_radius),0); -$path_string .= a($corner_radius, $corner_radius, 0, 0, 0, -$corner_radius, $corner_radius); -$path_string .= l(0, ($height - 2*$corner_radius)); -$path_string .= a($corner_radius, $corner_radius, 0, 0, 0, $corner_radius, $corner_radius); - -$path_string .= " Z"; -my $path = $svg->path(d => $path_string, stroke => 'black', fill => 'white'); - -say $svg->render(); - -sub L { " L " . join(",", @_); } -sub l { " l " . join(",", @_); } -sub a { " a $_[0],$_[1] $_[2] $_[3] $_[4] $_[5],$_[6]"; } diff --git a/test.pl b/test.pl deleted file mode 100644 index c410137..0000000 --- a/test.pl +++ /dev/null @@ -1,127 +0,0 @@ -use v5.30; - -use HexGrid; -use HexGrid::Pin; -use Data::Dumper; - -use Text::Lorem; -my $lorem = Text::Lorem->new; - -# my $adder_pin = new HexGrid::Pin(id => 'mountain-pin', icon => 'mountain.svg', name => 'Adder', description => $lorem->sentences(1)); -my $grid = HexGrid->new(defaults => { style => { 'stroke-width' => 1, 'stroke' => 'black' }, show_coords => 1 }); - -$grid->make_region("Viper's Gate", colour => 'red'); -# $grid->make_region('Adderwall', colour => 'orange', pins => {n => $adder_pin}); -my $adderwall = $grid->make_region('Adderwall', colour => 'orange'); -# $adderwall->make_subregion('Adderwall foothills', colour => 'moccasin'); -$grid->make_region('Adderwall foothills', colour => 'moccasin'); -$grid->make_region('Midhills', colour => 'moccasin'); -# $grid->make_region('Minev', colour => 'green', images => ["forest-tile.png"]); -$grid->make_region('Minev', colour => 'green'); -$grid->make_region('Barrowcross', colour => 'darkgreen'); -$grid->make_region('Shinei Mavet', colour => 'orange'); -$grid->make_region('Jagged Shinei Mavet', colour => 'orange'); -$grid->make_region('Shinei Mavet waters', colour => 'lightcyan'); -# $grid->make_region('Shinei Mavet', colour => 'orange', image => 'mountain.svg'); -# $grid->make_region('Jagged Shinei Mavet', colour => 'orange', images => ['mountain.svg', 'jagged.svg']); -# $grid->make_region('Shinei Mavet waters', colour => 'lightcyan', image => 'foo.png'); -$grid->make_region('Southern Ocean', colour => 'skyblue'); -$grid->make_region('A volcano', colour => 'orange'); -$grid->make_region('Buslish Scrubs', colour => 'beige'); -$grid->make_region('The Blasted Metropolis', colour => 'gray'); -$grid->make_region('The sprawling grasses', colour => 'beige'); -$grid->make_region('Something sandy?', colour => 'navajowhite'); -$grid->make_region('Necromancer', colour => 'orange'); -$grid->make_region('The Narrow Sea', colour => 'skyblue'); -$grid->make_region('Naurardhon', colour => 'palegoldenrod'); -$grid->make_region('The Glades of Leamingbury', colour => 'lightgreen'); -$grid->make_region('Cape of Lost Causes', colour => 'gray'); -$grid->make_region('Deadlands', colour => 'black'); -$grid->make_region('Deadlands', colour => 'black'); -$grid->make_region('Glade borders', colour => 'mediumaquamarine'); -$grid->make_region('Thicket', colour => 'darkgreen'); -$grid->make_region('Random house', colour => 'darkgreen'); -$grid->make_region('Abbey of Plendor', colour => 'beige'); -$grid->make_region('Khulanu', opacity => '0', style => { 'stroke-width' => 5, 'stroke' => 'black' }); - -my $tiles; -open $tiles, "$ENV{HOME}/RPG-stuff/WestOfVipers/coordinate-mapping"; - -my $region = <$tiles>; -chomp($region); -while(my $coords = <$tiles>) -{ - if ($coords =~ /^\s*$/) - { - $region = <$tiles>; - chomp($region); - next; - } - chomp $coords; - my %settings; - if($coords =~ /:$/) - { - for(my $line = <$tiles>; $line !~ /^;/; $line = <$tiles>) - { - my($key, $val) = split /:/, $line; - $settings{$key} = $val; - } - chop($coords); - } - my ($nw,$sw) = split /,/, $coords; - my $tile = $grid->{regions}{$region}->make_tile_at($nw, $sw, %settings); - if($region eq "Necromancer") - { - $tile->pin(new HexGrid::Pin(id => "circle-pin", icon => "foo2.svg", name => "zap", description => scalar $lorem->paragraphs(4), href => 'http://www.tensor.green')); - } -} - -close $tiles; - -# $grid->get_tile_at(0,0)->pin( -# $grid->{regions}{"Viper's Gate"}{tiles}{0}{0}->pin( -# { -# 'n' => new HexGrid::Pin(icon => "1"), -# 'se' => new HexGrid::Pin(icon => "2"), -# 'sw' => new HexGrid::Pin(icon => "3") -# } -# ); - -# $grid->get_tile_at(0,0)->pin( -# new HexGrid::Pin(icon => "foo2.svg"), -# 'se' -# ); -# $grid->get_tile_at(0,0)->pin( -# new HexGrid::Pin(icon => "mountain.svg") -# ); -# $grid->get_tile_at(0,0)->pin( -# new HexGrid::Pin(icon => "foo2.svg") -# ); -# $grid->{regions}{"Viper's Gate"}{tiles}{0}{0}->pin( -# new HexGrid::Pin(icon => "2") -# ); -# $grid->{regions}{"Viper's Gate"}{tiles}{0}{0}->pin( -# new HexGrid::Pin(icon => "3"), -# 'sw' -# ); - -say ""; -say "\n
"; -say <