NAME
TUI::Drivers::HardwareInfo - platform-independent hardware interface dispatcher
SYNOPSIS
use TUI::Drivers::HardwareInfo;
my $hw = THardwareInfo;
my $ticks = $hw->getTickCount();
my $cols = $hw->getScreenCols();
my $rows = $hw->getScreenRows();
DESCRIPTION
THardwareInfo provides the platform-independent entry point for hardware-related operations used by the TUI::Vision driver layer.
This module does not implement any hardware access itself. Instead, it selects and loads a platform-specific backend at runtime and exposes it under the symbolic name THardwareInfo.
All calls made through THardwareInfo are delegated directly to the active backend implementation.
This module contains the public interface documentation for the THardwareInfo symbol. Backend modules provide platform-specific implementation details.
THardwareInfo must not be instantiated.
Commonly Used Features
Typical code uses THardwareInfo as a static interface for low-level driver queries and operations, for example: reading screen dimensions (getScreenCols()/getScreenRows()), checking timing (getTickCount()), reading platform information (getPlatform()), and performing caret/screen operations needed by the event and display layers.
In normal application code, these methods are usually accessed indirectly through higher-level modules such as TScreen, TDisplay, TEventQueue, and mouse/system-error wrappers.
PLATFORM DISPATCH
At load time, the module determines the active operating system and loads the corresponding backend module.
Current backend availability in this distribution:
- Windows systems: TUI::Drivers::HardwareInfo::Win32 - Non-Windows systems: no backend module is currently shipped
As of now, this dispatcher is effectively Win32-only. Attempting to load THardwareInfo on unsupported platforms will fail until additional backend implementations are added.
Calling code must always refer to the interface via the THardwareInfo symbol and must not depend on platform-specific module names.
METHODS
getPlatform
my $os = THardwareInfo->getPlatform();
Returns the platform name string.
getTickCount
my $ticks = THardwareInfo->getTickCount();
Returns the system tick count.
clearPendingEvent
THardwareInfo->clearPendingEvent();
Clears any buffered input event.
getKeyEvent
my $bool = THardwareInfo->getKeyEvent($event);
Retrieves the next keyboard event and stores it in the supplied event structure.
getMouseEvent
my $bool = THardwareInfo->getMouseEvent($event);
Retrieves the next mouse event and stores it in the supplied event structure.
getButtonCount
my $count = THardwareInfo->getButtonCount();
Returns the number of mouse buttons detected.
getScreenCols
my $cols = THardwareInfo->getScreenCols();
Returns the number of screen columns.
getScreenRows
my $rows = THardwareInfo->getScreenRows();
Returns the number of screen rows.
getScreenMode
my $mode = THardwareInfo->getScreenMode();
Returns the current screen mode.
setScreenMode
THardwareInfo->setScreenMode($mode);
Sets the screen mode.
clearScreen
THardwareInfo->clearScreen($width, $height);
Clears the screen using the specified dimensions.
allocateScreenBuffer
my @buffer = THardwareInfo->allocateScreenBuffer();
Allocates a screen buffer suitable for bulk screen updates.
freeScreenBuffer
THardwareInfo->freeScreenBuffer(\@buffer);
Releases a previously allocated screen buffer.
screenWrite
THardwareInfo->screenWrite($x, $y, $buffer, $len);
Writes raw character data to the screen.
cursorOn
THardwareInfo->cursorOn();
Makes the text cursor visible.
cursorOff
THardwareInfo->cursorOff();
Hides the text cursor.
getCaretSize
my $size = THardwareInfo->getCaretSize();
Returns the current caret size encoding.
setCaretSize
THardwareInfo->setCaretSize($size);
Sets the caret size encoding.
setCaretPosition
THardwareInfo->setCaretPosition($x, $y);
Sets the caret position.
isCaretVisible
my $bool = THardwareInfo->isCaretVisible();
Returns true if the caret is visible.
setCtrlBrkHandler
my $ok = THardwareInfo->setCtrlBrkHandler($install);
Installs or removes the Ctrl-Break handler.
setCritErrorHandler
my $ok = THardwareInfo->setCritErrorHandler($install);
Installs or removes the critical error handler.
SEE ALSO
TUI::Drivers::HardwareInfo::Win32, TUI::Drivers::Screen, TUI::Drivers::HWMouse, TUI::Drivers::SystemError
AUTHORS
Borland International (original Turbo Vision design)
J. Schneider <brickpool@cpan.org> (Perl implementation and maintenance)
COPYRIGHT AND LICENSE
Copyright (c) 1990-1994, 1997 by Borland International
Copyright (c) 2021-2026 the "AUTHORS" as listed above.
This software is licensed under the MIT license (see the LICENSE file, which is part of the distribution).