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 (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.
-
Moves the cursor to y, x and writes the string $str, which can contain <color> tags
- cursor([bool])
-
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.
SEE ALSO
Games::Roguelike::Console::ANSI, Games::Roguelike::Console::Win32, Games::Roguelike::Console::Curses
AUTHOR
Erik Aronesty earonesty@cpan.org
LICENSE
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See http://www.perl.com/perl/misc/Artistic.html or the included LICENSE file.