EXPORTS
Nothing per default, but can export the following per request:
:all
:api
Init
Close
Interrupt
Flush
SetCursor
HideCursor
SetCell
GetCell
SetChar
SetFg
SetBg
CellBuffer
PollEvent
Size
Clear
SetInputMode
SetOutputMode
Sync
NAME
Termbox::Go::Win32 - Win32 Termbox implementation
DESCRIPTION
This document describes the Termbox library for Perl, for the use of Windows console applications.
The advantage of the Termbox library is the use of an standard. Termbox contains a few functions with which console applications can be developed with high portability and interoperability.
COPYRIGHT AND LICENCE
This file is part of the port of Termbox.
Copyright (C) 2012 by termbox-go authors
This library content was taken from the termbox-go implementation of Termbox
which is licensed under MIT licence.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
AUTHORS
2024,2025 by J. Schneider https://github.com/brickpool/
DISCLAIMER OF WARRANTIES
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
REQUIRES
SEE ALSO
SUBROUTINES
CellBuffer
my \@arrayref = CellBuffer();
Returns a slice into the termbox's back buffer. You can get its dimensions using "Size" function. The slice remains valid as long as no "Clear" or "Flush" function calls were made after call to this function.
Clear
my $errno = Clear($fg, $bg);
Clears the internal back buffer.
Close
my $errno = Close();
Finalizes termbox library, should be called after successful initialization when termbox's functionality isn't required anymore.
Flush
my $errno = Flush();
Synchronizes the internal back buffer with the terminal.
GetCell
my \%Cell = GetCell($x, $y);
Returns the specified cell from the internal back buffer.
HideCursor
my $errno = HideCursor();
The shortcut for SetCursor(-1, -1).
Init
my $errno = Init();
Initializes termbox library. This function should be called before any other functions. After successful initialization, the library must be finalized using "Close" function.
Example usage:
my $err = Init();
if ($err != 0) {
die "Error: $err"
}
Close();
Interrupt
my $errno = Interrupt();
Interrupt an in-progress call to "PollEvent" by causing it to return EventInterrupt. Note that this function will block until the "PollEvent" function has successfully been interrupted.
PollEvent
my \%Event = PollEvent();
Wait for an event and return it. This is a blocking function call.
SetBg
my $errno = SetBg($x, $y, $bg);
Changes cell's background attributes in the internal back buffer at the specified position.
SetCell
my $errno = SetCell($x, $y, $ch, $fg, $bg);
Changes cell's parameters in the internal back buffer at the specified position.
SetChar
my $errno = SetChar($x, $y, $ch);
Changes cell's character (length($ch) == 1) in the internal back buffer at the specified position.
SetCursor
my $errno = SetCursor($x, $y);
Sets the position of the cursor. See also "HideCursor".
SetFg
my $errno = SetFg($x, $y, $fg);
Changes cell's foreground attributes in the internal back buffer at the specified position.
SetInputMode
my $current = SetInputMode($mode);
Sets termbox input mode. Termbox has two input modes:
1. Esc input mode. When ESC sequence is in the buffer and it doesn't match any known sequence. ESC means 'KeyEsc'. This is the default input mode.
2. Alt input mode. When ESC sequence is in the buffer and it doesn't match any known sequence. ESC enables 'ModAlt' modifier for the next keyboard event.
Both input modes can be OR'ed with Mouse mode. Setting Mouse mode bit up will enable mouse button press/release and drag events.
If $mode is 'InputCurrent', returns the current input mode. See also 'Input*' constants.
SetOutputMode
my $current = SetOutputMode($mode);
Sets the termbox output mode.
As the Windows console only supports additional color modes starting with the Anniversary Update for Windows 10, OutputNormal is always set and returned here.
Size
my ($x, $y) = Size();
Returns the size of the internal back buffer (which is mostly the same as console's window size in characters). But it doesn't always match the size of the console window, after the console size has changed, the internal back buffer will get in sync only after "Clear" or "Flush" function calls.
Sync
my $errno = Sync();
Sync comes handy when something causes desync between termbox's understanding of a terminal buffer and the reality. Such as a third party process. Sync forces a complete resync between the termbox and a terminal, it may not be visually pretty though. At the moment on Windows it does nothing.