The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Gtk2::Hexgrid::Tile - a hexagonal tile from a Hexgrid

SYNOPSIS

my $item1 = $tile->set_background("images/squid.png");
my $item2 = $tile->set_text("blah", 18);
my $item3 = new Gtk2::Hexgrid::Item("text", "blah", 15);
my $item4 = new Gtk2::Hexgrid::Item("image", "imageName");
$item4->set_priority(5);
$item4->set_tile($tile);

METHODS

new

my $item3 = new Gtk2::Hexgrid::Item("text", "blah", 15);
my $item4 = new Gtk2::Hexgrid::Item("image", "imageName");

The type, "text" or "image", is in the first field. If "text", the text and font size are in the next fields. If 'image', the image name is in the next field. The image name is used as a key to the actual image. Images are loaded by Gtk2::Hexgrid::load_image.

copy

my $newItem = $item->copy();

Returns a clone of caller item.

accessors

tile
type
text
size
priority
imageName

detach

$item->detach;

Removes self from its parent and starts floating in space

attach

$item->attach($tile);

Performs a detach in reverse.

set_priority

Each item has a priority, the default being 0. Items with lower priorities are drawn before items with higher priorities. I've given backgrounds a priority of -21.21, and text is 21.21. They are not round numbers because items with the same priority are prioritized by thich item was attached first, and that may cause weird behavior.