View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Erik Aronesty > Roguelike-Utils > Games::Roguelike::Console



Annotate this POD


New  3
Open  0
View/Report Bugs
Module Version: 0.4.256   Source  


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


 use Games::Roguelike::Console;

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


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


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

Create a new console, optionally specifying the subtype (win32, ansi, curses or dump:file[:keys]), and the noinit flag (which suppresses terminal initialization.)

If a type is not specified, a suitable default will be chosen.

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

Prints a string at the y, x positions or at the current cursor position (also positions the cursor at y, x+length(str))

attron ($color)

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.

Subclass can define this instead of nativecolor, if desired.

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

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


Changes the state of whether the cursor is shown, or returns the current state.

rect(x, y, w, h)

Sets the left margin (x) for things that parse out carraige returns, and is the rectangle used for scrolling.


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


Erik Aronesty


This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See or the included LICENSE file.

syntax highlighting: