NAME
TUI::Drivers::Screen - global screen and video mode management
SYNOPSIS
use TUI::Drivers::Screen;
use TUI::Drivers::Const qw( smCO80 smFont8x8 );
# Initialize driver-side screen state.
TScreen->resume();
# Select an 80x50 style text mode (platform-adjusted by fixCrtMode).
TScreen->setVideoMode( smCO80 | smFont8x8 );
# Optional explicit clear.
TScreen->clearScreen();
# Restore startup mode/cursor on shutdown.
TScreen->suspend();
DESCRIPTION
TScreen provides global screen and video mode management facilities used by the TUI::Vision driver layer.
The module maintains global state describing the current screen configuration and provides class-level routines to suspend, resume, and reinitialize the video subsystem.
TScreen is not an object-oriented class. It is not instantiated and does not represent a view. All interaction is performed through class method calls of the form TScreen->method.
Commonly Used Features
In normal application flow, TScreen is primarily used to coordinate screen lifecycle transitions (resume() and suspend()) and to switch video mode via setVideoMode().
When a mode change occurs, the module refreshes shared screen state such as $screenWidth, $screenHeight, and $hiResScreen, and updates mouse range through TMouse when mouse support is available.
VARIABLES
$startupMode
Stores the screen mode that was active before TUI::Vision initialized the video system.
This value is used to restore the original screen mode when TUI::Vision suspends or terminates.
$startupCursor
Stores the initial cursor shape before TUI::Vision modifies the cursor.
$screenMode
Holds the current screen mode requested by the application.
$screenWidth
Contains the current screen width in character columns.
Typical values are 80 or similar.
$screenHeight
Contains the current screen height in text rows.
Typical values are 25, 43, or 50 depending on the selected video mode.
$hiResScreen
Indicates whether a high-resolution text mode is active.
$checkSnow
Controls CGA snow checking behavior.
If true, TUI::Vision performs additional checks to avoid display artifacts on older CGA adapters. This variable should not be modified before application initialization has completed.
$screenBuffer
Reference to the internal screen buffer.
This variable is initialized during screen setup and tracks the location of the video memory buffer.
$cursorLines
Encodes the current cursor shape.
The high nibble represents the top scan line, and the low nibble represents the bottom scan line of the cursor.
$clearOnSuspend
Controls whether the screen is cleared when the video subsystem is suspended.
METHODS
clearScreen
TScreen->clearScreen();
Clears the screen after the video subsystem has been resumed.
Most applications do not need to call this method explicitly.
fixCrtMode
my $mode = TScreen->fixCrtMode($mode);
Adjusts the supplied screen mode value to match hardware constraints.
setVideoMode
TScreen->setVideoMode($mode);
Selects a new screen mode.
This method changes the screen color mode and optionally the screen height. Typically, applications should call TProgram->setScreenMode instead, which performs additional updates such as palette and mouse repositioning.
suspend
TScreen->suspend();
Suspends TUI::Vision video support and restores the original screen state.
This method is called automatically during application shutdown.
resume
TScreen->resume();
Initializes the TUI::Vision video subsystem and switches the display to the mode specified by $screenMode.
This method initializes $screenWidth, $screenHeight, $hiResScreen, $checkSnow, $screenBuffer, and $cursorLines.
SEE ALSO
TUI::App::Program, TUI::Drivers::Display, TUI::Drivers::HardwareInfo
AUTHORS
Borland International (original Turbo Vision design)
J. Schneider <brickpool@cpan.org> (Perl implementation and maintenance)
CONTRIBUTORS
Contributors are documented in the POD of the respective framework modules.
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).