47 Heads-up Display (HUD)
This walkthrough examines the HUD text widgets defined in linuxdoom-1.10/hu_lib.h
and their initialization in hu_lib.c
.
47.1 hu_lib.h Highlights
47.1.1 hu_textline_t
Lines 45–59 define a single-line text widget: - Position: (x, y)
- Font array: f
- Start character: sc
- Character buffer: l
- Current length: len
- Update flag: needsupdate
47.1.2 hu_stext_t
Lines 65–75 define a scrolling multi-line text widget: - Text lines: l[HU_MAXLINES]
- Window height: h
- Current insert line: cl
- Visibility flag: on
47.1.3 hu_itext_t
Lines 81–92 define a user input text line: - Embedded hu_textline_t
- Left margin: lm
- Visibility flag: pointer on
- Last-on state: laston
47.2 hu_lib.c Highlights
47.2.1 HUlib_initTextLine
Lines 53–66: - Sets position (x, y)
, font f
, and start character sc
- Clears text via HUlib_clearTextLine
47.2.2 HUlib_initSText
Lines 176–197: - Sets height h
, on
flag, and resets cl
- Calls HUlib_initTextLine
on each sub-line
47.2.3 HUlib_initIText
Lines 270–282: - Sets lm = 0
, initializes on
and laston
- Calls HUlib_initTextLine
for its internal textline
That was it.