Termbox::Cell - A Single Conceptual Entity on the Terminal Screen
The terminal screen is represented as 2d array of cells. The structure is optimized for dealing with single-width (wcwidth()==1) Unicode code points, however some support for grapheme clusters (e.g., combining diacritical marks) and wide code points (e.g., Hiragana) is provided through ech, nech, cech via Termbox::tb_set_cell_ex( ... ). ech is only valid when nech>0, otherwise ch is used.
Termbox::tb_set_cell_ex( ... )
For non-single-width code points, given N=wcwidth(ch)/wcswidth(ech):
N=wcwidth(ch)/wcswidth(ech)
termbox2 forces a single-width cell. Callers should avoid this if aiming to render text accurately.
termbox zeroes out the following N-1 cells and skips sending them to the tty. So, e.g., if the caller sets x=0,y=0 to an N==2 code point, the caller's next set should be at x=2,y=0. Anything set at x=1,y=0 will be ignored. If there are not enough columns remaining on the line to render N width, spaces are sent instead.
See tb_present( ) for implementation.
tb_present( )
Each cell contains the following values:
ch( )
A single Unicode character, if available.
fg( )
Bitwise foreground attributes.
bg( )
Bitwise background attributes.
ech( )
A grapheme cluster of Unicode code points.
This is only defined if extended grapheme clusters are enabled.
nech( )
Length in bytes of ech, 0 means use ch instead of ech.
cech( )
Capacity in bytes of extended grapheme cluster.
Copyright (C) Sanko Robinson.
This library is free software; you can redistribute it and/or modify it under the terms found in the Artistic License 2. Other copyrights, terms, and conditions may apply to data transmitted through this module.
Sanko Robinson <sanko@cpan.org>
To install Termbox, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Termbox
CPAN shell
perl -MCPAN -e shell install Termbox
For more information on module installation, please visit the detailed CPAN module installation guide.