NAME

Game::Terminal::Kit::Frame - marks that are shapes, not colours

VERSION

Version 0.05

SYNOPSIS

use Game::Terminal::Kit::Frame;

my @tile = Game::Terminal::Kit::Frame::around('cursor', $ascii, ' 6 ', ' 4 ');
#  ┏━━━┓        +===+
#  ┃ 6 ┃   or   | 6 |
#  ┃ 4 ┃        | 4 |
#  ┗━━━┛        +===+

my ($open, $close) = Game::Terminal::Kit::Frame::brackets('recent');
my $compact = $open . '6|4' . $close;      # {6|4}

DESCRIPTION

A game that is played with a cursor shows two kinds of marked piece at once: the one the cursor is on, which is what would change, and the ones played since the player last looked, which is what did change. They answer different questions and are never on screen apart, so they need two looks. Colour cannot be the difference, because a mark has to survive NO_COLOR, a terminal without colour and output sent to a file.

So each mark is a shape. A boxed piece gets a box of a different weight; a piece on one line gets different brackets. Every glyph is one column wide, in Unicode and in ASCII, so a marked piece is exactly the size of a plain one and nothing shifts when the cursor moves. Colour then goes on top, from the game, as a second way of saying the same thing.

The marks

mark      box                ASCII box       brackets
plain     light   ┌─┐│└┘     +-+|            none
recent    double  ╔═╗║╚╝     #=#|            { }
cursor    heavy   ┏━┓┃┗┛     +=+|            [ ]
from      light                              ( )
target    light                              < >

plain is a piece with nothing to say. recent is one that changed since the player last looked. cursor is the one a key would act on. from and target are for a move in two steps: the piece taken up, and where it may go. A name that is none of these is plain.

FUNCTIONS

None is exported.

box

my $box = Game::Terminal::Kit::Frame::box($mark, $ascii);

The eight glyphs of the mark's box, as a hash reference with the keys tl, t, tr, l, r, bl, b and br. In ASCII when the second argument is true.

around

my @lines = Game::Terminal::Kit::Frame::around($mark, $ascii, @lines);

The lines inside the mark's box: two lines more and two columns wider, with short lines padded to the longest.

brackets

my ($open, $close) = Game::Terminal::Kit::Frame::brackets($mark);

The two characters to put either side of a piece drawn on one line. Two spaces for plain, so a row of pieces stays in step.

strongest

my $mark = Game::Terminal::Kit::Frame::strongest(@marks);

The one to draw when a piece has several: cursor, then from, target, recent, and plain when there are none.

marks

parts

known

The names of the marks, strongest first; the eight keys of a box, in the order a box is read; and a mark's own name, or plain for anything else.

SEE ALSO

Game::Terminal::Kit, Game::Terminal::Kit::Canvas.

AUTHOR

LNATION, <email at lnation.org>

LICENSE AND COPYRIGHT

This software is Copyright (c) 2026 by LNATION.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)