NAME

Games::Roguelike::Console - platform-neutral console handling

SYNOPSIS

use Games::Roguelike::Console;

$con = Games::Roguelike::Console->new();
$con->attron('bold yellow');
$con->addstr('test');
$con->attroff();
$con->refresh();

DESCRIPTION

Attempts to figure out which Games::Roguelike::Console subclass to instantiate in order to provide console support.

METHODS

new ([type=>$stype], [noinit=>1])

create a new console, optionally specifying the subtype (currently: win32, ansi or curses), and the noinit flag (which suppresses terminal init)

addch ([$y, $x], $str);
addstr ([$y, $x], $str);

prints a string at the y, x positions or at the current cursor position (also positions and advances the cursor to y, x+length(str))

attron ($attr)

turns on color attributes ie: bold blue, white, white on black, black on bold blue

attroff ()

turns off color attributes

refresh ()

draws the current screen

redraw ()

redraws entire screen (if out of sync)

move ($y, $x)

moves the cursor to y, x

getch ()

reads a character from input

nbgetch ()

reads a character from input, non-blocking

parsecolor ()

helper function for subclass, parses an attribute then calls "nativecolor($fg, $bg, $bold)", caching the results

tagstr ([$x,$y,] $str)

moves the cursor to x/y and writes the string $str, which can contain <color> tags

xymove ($x,$y)

moves the cursor to x/y

xych ($x,$y)

moves the cursor to x/y, and writes a character

xystr ($x,$y)

moves the cursor to x/y, and writes a string

SEE ALSO

Games::Roguelike::Console::ANSI, Games::Roguelike::Console::Win32, Games::Roguelike::Console::Curses