Files
src/hu_lib.ml
Implements HUD scrolling text, editable input lines, font drawing, and dirty-region erasure for classic view borders.
- Package
(global)- Reachable
- Yes
Imports
Declarations
# _HUlib_appendBytes
function _HUlib_appendBytes(tl, b)
Appends an entire byte sequence through the text-line capacity and dirty-state rules.
| Parameter | Type | Default | Description |
|---|
tl | dynamic | — | Tl value supplied to `_HUlib_appendBytes`. |
b | dynamic | — | Second input operand. |
View source
# _HUlib_needsVal
inline function _HUlib_needsVal(v)
Normalizes numeric or boolean dirty-line state to the integer redraw count consumed by erase logic.
| Parameter | Type | Default | Description |
|---|
v | dynamic | — | Value consumed by the operation. |
View source
# _HUlib_patchAt
inline function _HUlib_patchAt(font, idx)
Safely retrieves one glyph patch from a font array without exposing out-of-range indexing.
| Parameter | Type | Default | Description |
|---|
font | dynamic | — | Font value supplied to `_HUlib_patchAt`. |
idx | dynamic | — | Zero-based element or table index. |
View source
# _HUlib_patchHeight
inline function _HUlib_patchHeight(p)
Reads a validated font patch's signed little-endian height, returning zero for absent data.
| Parameter | Type | Default | Description |
|---|
p | dynamic | — | Object or data record consumed by the operation. |
View source
# _HUlib_patchWidth
inline function _HUlib_patchWidth(p)
Reads a validated font patch's signed little-endian width, returning zero for absent data.
| Parameter | Type | Default | Description |
|---|
p | dynamic | — | Object or data record consumed by the operation. |
View source
# _HUlib_refBool
inline function _HUlib_refBool(v)
Resolves direct or single-element referenced values to the truth value used by HUD visibility toggles.
| Parameter | Type | Default | Description |
|---|
v | dynamic | — | Value consumed by the operation. |
View source
# _HUlib_toByte
inline function _HUlib_toByte(ch)
Normalizes an integer or one-character string to the byte value stored in HUD text buffers.
| Parameter | Type | Default | Description |
|---|
ch | dynamic | — | Ch value supplied to `_HUlib_toByte`. |
View source
# _HUlib_upper
inline function _HUlib_upper(c)
Converts lowercase ASCII glyph codes to the uppercase range used by Doom's HUD font.
| Parameter | Type | Default | Description |
|---|
c | dynamic | — | C value supplied to `_HUlib_upper`. |
View source
# HU_CHARERASE
const HU_CHARERASE = 127
Defines hu charerase for the hu lib subsystem.
View source
hu_itext_t struct
# HU_MAXLINELENGTH
const HU_MAXLINELENGTH = 80
Defines the maximum hu maxlinelength accepted by the hu lib subsystem.
View source
# HU_MAXLINES
const HU_MAXLINES = 4
Defines the maximum hu maxlines accepted by the hu lib subsystem.
View source
hu_stext_t struct
hu_textline_t struct
# HUlib_addCharToTextLine
function HUlib_addCharToTextLine(t, ch)
Appends one normalized byte when capacity permits, maintains the zero terminator, and schedules four redraws.
| Parameter | Type | Default | Description |
|---|
t | dynamic | — | T value supplied to `HUlib_addCharToTextLine`. |
ch | dynamic | — | Ch value supplied to `HUlib_addCharToTextLine`. |
View source
# HUlib_addLineToSText
function HUlib_addLineToSText(s)
Advances the circular message cursor, clears the reused line, and marks every visible stack line dirty.
| Parameter | Type | Default | Description |
|---|
s | dynamic | — | S value supplied to `HUlib_addLineToSText`. |
View source
# HUlib_addMessageToSText
function HUlib_addMessageToSText(s, prefix, msg)
Opens a new stack line and concatenates an optional prefix with the message text.
| Parameter | Type | Default | Description |
|---|
s | dynamic | — | S value supplied to `HUlib_addMessageToSText`. |
prefix | dynamic | — | Prefix value supplied to `HUlib_addMessageToSText`. |
msg | dynamic | — | Msg value supplied to `HUlib_addMessageToSText`. |
View source
# HUlib_addPrefixToIText
function HUlib_addPrefixToIText(it, str)
Appends a fixed prompt prefix and advances the deletion boundary to protect it from backspace.
| Parameter | Type | Default | Description |
|---|
it | dynamic | — | It value supplied to `HUlib_addPrefixToIText`. |
str | dynamic | — | Str value supplied to `HUlib_addPrefixToIText`. |
View source
# HUlib_clearTextLine
function HUlib_clearTextLine(t)
Clears hUlib clear Text Line state before the next heads-up display update.
| Parameter | Type | Default | Description |
|---|
t | dynamic | — | T value supplied to `HUlib_clearTextLine`. |
View source
# HUlib_delCharFromIText
function HUlib_delCharFromIText(it)
Deletes one input byte only when it lies after the protected prefix boundary.
| Parameter | Type | Default | Description |
|---|
it | dynamic | — | It value supplied to `HUlib_delCharFromIText`. |
View source
# HUlib_delCharFromTextLine
function HUlib_delCharFromTextLine(t)
Removes the final byte from a nonempty HUD line, restores termination, and schedules redraws.
| Parameter | Type | Default | Description |
|---|
t | dynamic | — | T value supplied to `HUlib_delCharFromTextLine`. |
View source
# HUlib_drawIText
function HUlib_drawIText(it)
Draws a visible editable line with the cursor glyph placed after its current text.
| Parameter | Type | Default | Description |
|---|
it | dynamic | — | It value supplied to `HUlib_drawIText`. |
View source
# HUlib_drawSText
function HUlib_drawSText(s)
Draws visible stack lines newest-first by walking backward through the circular buffer.
| Parameter | Type | Default | Description |
|---|
s | dynamic | — | S value supplied to `HUlib_drawSText`. |
View source
# HUlib_drawTextLine
function HUlib_drawTextLine(l, drawcursor)
Renders a HUD text buffer with patch-font glyph widths, optional cursor, spaces, and right-edge clipping.
| Parameter | Type | Default | Description |
|---|
l | dynamic | — | L value supplied to `HUlib_drawTextLine`. |
drawcursor | dynamic | — | Drawcursor value supplied to `HUlib_drawTextLine`. |
View source
# HUlib_eraseIText
function HUlib_eraseIText(it)
Erases a dirty input line, forcing redraws when its externally controlled visibility turns off.
| Parameter | Type | Default | Description |
|---|
it | dynamic | — | It value supplied to `HUlib_eraseIText`. |
View source
# HUlib_eraseLineFromIText
function HUlib_eraseLineFromIText(it)
Removes all editable input while retaining the protected prefix bytes.
| Parameter | Type | Default | Description |
|---|
it | dynamic | — | It value supplied to `HUlib_eraseLineFromIText`. |
View source
# HUlib_eraseSText
function HUlib_eraseSText(s)
Marks lines dirty on visibility transitions, erases every stack line, and remembers the current visibility state.
| Parameter | Type | Default | Description |
|---|
s | dynamic | — | S value supplied to `HUlib_eraseSText`. |
View source
# HUlib_eraseTextLine
function HUlib_eraseTextLine(l)
Restores border regions covered by a dirty HUD line and decrements its multi-frame redraw counter.
| Parameter | Type | Default | Description |
|---|
l | dynamic | — | L value supplied to `HUlib_eraseTextLine`. |
View source
# HUlib_init
function HUlib_init()
Preserves the original HUD-library initialization hook; this implementation has no module-wide resources to allocate.
View source
# HUlib_initIText
function HUlib_initIText(it, x, y, font, startchar, on)
Creates an editable HUD line, clears its protected-prefix boundary, and attaches its visibility reference.
| Parameter | Type | Default | Description |
|---|
it | dynamic | — | It value supplied to `HUlib_initIText`. |
x | dynamic | — | Horizontal map- or screen-space coordinate. |
y | dynamic | — | Vertical map- or screen-space coordinate. |
font | dynamic | — | Font value supplied to `HUlib_initIText`. |
startchar | dynamic | — | Startchar value supplied to `HUlib_initIText`. |
on | dynamic | — | On value supplied to `HUlib_initIText`. |
View source
# HUlib_initSText
function HUlib_initSText(s, x, y, h, font, startchar, on)
Builds a fixed-height circular message stack whose lines are vertically spaced from the font height.
| Parameter | Type | Default | Description |
|---|
s | dynamic | — | S value supplied to `HUlib_initSText`. |
x | dynamic | — | Horizontal map- or screen-space coordinate. |
y | dynamic | — | Vertical map- or screen-space coordinate. |
h | dynamic | — | H value supplied to `HUlib_initSText`. |
font | dynamic | — | Font value supplied to `HUlib_initSText`. |
startchar | dynamic | — | Startchar value supplied to `HUlib_initSText`. |
on | dynamic | — | On value supplied to `HUlib_initSText`. |
View source
# HUlib_initTextLine
function HUlib_initTextLine(t, x, y, f, sc)
Assigns position and font metadata, allocates a bounded text buffer, and marks a HUD line dirty.
| Parameter | Type | Default | Description |
|---|
t | dynamic | — | T value supplied to `HUlib_initTextLine`. |
x | dynamic | — | Horizontal map- or screen-space coordinate. |
y | dynamic | — | Vertical map- or screen-space coordinate. |
f | dynamic | — | F value supplied to `HUlib_initTextLine`. |
sc | dynamic | — | Sc value supplied to `HUlib_initTextLine`. |
View source
# HUlib_keyInIText
function HUlib_keyInIText(it, ch)
Applies printable, backspace, or enter input to an editable HUD line and reports whether the key was consumed.
| Parameter | Type | Default | Description |
|---|
it | dynamic | — | It value supplied to `HUlib_keyInIText`. |
ch | dynamic | — | Ch value supplied to `HUlib_keyInIText`. |
View source
# HUlib_resetIText
function HUlib_resetIText(it)
Clears hUlib reset IText state before the next heads-up display update.
| Parameter | Type | Default | Description |
|---|
it | dynamic | — | It value supplied to `HUlib_resetIText`. |
View source