Games-Rezrov
view release on metacpan or search on metacpan
ZIO_Win32.pm view on Meta::CPAN
package Games::Rezrov::ZIO_Win32;
# z-machine i/o for perls with Win32::Console
# TO DO:
# - handle scrollbars/buffering properly...it would be nice
# if old game text could be seen via an existing scrollbar.
# But this requires untangling screen Size() mess.
# - can we set hourglass when busy?
use strict;
use Win32::Console;
use Games::Rezrov::ZIO_Generic;
use Games::Rezrov::ZIO_Color;
use Games::Rezrov::ZConst;
use Carp qw(cluck);
use constant DEBUG => 0;
@Games::Rezrov::ZIO_Win32::ISA = qw(Games::Rezrov::ZIO_Generic
Games::Rezrov::ZIO_Color
);
my ($upper_lines, $rows, $columns, $in_status);
# number of lines in upper window, geometry
my ($IN, $OUT);
# Win32::Console instances
my @ORIG_SIZE;
if (DEBUG) {
# debugging; tough to redirect STDERR under win32 :(
open(LOG, ">zio.log") || die;
select(LOG);
$|=1;
select(STDOUT);
}
my %KEYCODES = (
38 => Games::Rezrov::ZConst::Z_UP,
40 => Games::Rezrov::ZConst::Z_DOWN,
37 => Games::Rezrov::ZConst::Z_LEFT,
39 => Games::Rezrov::ZConst::Z_RIGHT,
);
my (%FOREGROUND, %BACKGROUND);
foreach (qw(black
blue
lightblue
red
lightred
green
lightgreen
magenta
lightmagenta
cyan
lightcyan
brown
yellow
gray
white)) {
# make hash translating names to color codes exported by Win32::Console
no strict "refs";
$FOREGROUND{$_} = ${"main::FG_" . uc($_)};
$BACKGROUND{$_} = ${"main::BG_" . uc($_)};
}
( run in 1.042 second using v1.01-cache-2.11-cpan-13bb782fe5a )