MiniDoom

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.

ParameterTypeDefaultDescription
tldynamic—Tl value supplied to `_HUlib_appendBytes`.
bdynamic—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.

ParameterTypeDefaultDescription
vdynamic—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.

ParameterTypeDefaultDescription
fontdynamic—Font value supplied to `_HUlib_patchAt`.
idxdynamic—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.

ParameterTypeDefaultDescription
pdynamic—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.

ParameterTypeDefaultDescription
pdynamic—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.

ParameterTypeDefaultDescription
vdynamic—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.

ParameterTypeDefaultDescription
chdynamic—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.

ParameterTypeDefaultDescription
cdynamic—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.

ParameterTypeDefaultDescription
tdynamic—T value supplied to `HUlib_addCharToTextLine`.
chdynamic—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.

ParameterTypeDefaultDescription
sdynamic—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.

ParameterTypeDefaultDescription
sdynamic—S value supplied to `HUlib_addMessageToSText`.
prefixdynamic—Prefix value supplied to `HUlib_addMessageToSText`.
msgdynamic—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.

ParameterTypeDefaultDescription
itdynamic—It value supplied to `HUlib_addPrefixToIText`.
strdynamic—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.

ParameterTypeDefaultDescription
tdynamic—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.

ParameterTypeDefaultDescription
itdynamic—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.

ParameterTypeDefaultDescription
tdynamic—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.

ParameterTypeDefaultDescription
itdynamic—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.

ParameterTypeDefaultDescription
sdynamic—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.

ParameterTypeDefaultDescription
ldynamic—L value supplied to `HUlib_drawTextLine`.
drawcursordynamic—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.

ParameterTypeDefaultDescription
itdynamic—It value supplied to `HUlib_eraseIText`.

View source

HUlib_eraseLineFromIText

function HUlib_eraseLineFromIText(it)

Removes all editable input while retaining the protected prefix bytes.

ParameterTypeDefaultDescription
itdynamic—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.

ParameterTypeDefaultDescription
sdynamic—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.

ParameterTypeDefaultDescription
ldynamic—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.

ParameterTypeDefaultDescription
itdynamic—It value supplied to `HUlib_initIText`.
xdynamic—Horizontal map- or screen-space coordinate.
ydynamic—Vertical map- or screen-space coordinate.
fontdynamic—Font value supplied to `HUlib_initIText`.
startchardynamic—Startchar value supplied to `HUlib_initIText`.
ondynamic—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.

ParameterTypeDefaultDescription
sdynamic—S value supplied to `HUlib_initSText`.
xdynamic—Horizontal map- or screen-space coordinate.
ydynamic—Vertical map- or screen-space coordinate.
hdynamic—H value supplied to `HUlib_initSText`.
fontdynamic—Font value supplied to `HUlib_initSText`.
startchardynamic—Startchar value supplied to `HUlib_initSText`.
ondynamic—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.

ParameterTypeDefaultDescription
tdynamic—T value supplied to `HUlib_initTextLine`.
xdynamic—Horizontal map- or screen-space coordinate.
ydynamic—Vertical map- or screen-space coordinate.
fdynamic—F value supplied to `HUlib_initTextLine`.
scdynamic—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.

ParameterTypeDefaultDescription
itdynamic—It value supplied to `HUlib_keyInIText`.
chdynamic—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.

ParameterTypeDefaultDescription
itdynamic—It value supplied to `HUlib_resetIText`.

View source