-
Notifications
You must be signed in to change notification settings - Fork 113
views
title: Display Widgets (Views) description: Text views, bitmaps, database-driven numbers and gauges published: true editor: markdown
Views are display-only elements: they draw, they never take input. All of them accept the common element attributes; this page lists what each type adds. Color attributes everywhere take "R G B A" decimal or #RRGGBBAA hex, and an unparsable color silently becomes white, not black.

The static text view. Its size always comes from its content: w/h are ignored (zeroed at parse).
<view type="text" id="t1" posref="TL TL" x="12" y="-10" fontsize="18" shadow="true"
global_color="false" color="255 255 255 255" hardtext="Plain text 18" />Core attributes:
| attribute | default | meaning |
|---|---|---|
hardtext |
— | the text; strings starting with ui are looked up as translation keys |
hardtext_format |
— | translated text parsed for inline @{...} format tags (colors) |
color |
white | text color |
fontsize |
12 |
size in pixels (plus the global font coefficient option; fontsize_coef="false" opts out) |
fontweight / fontstyle
|
normal | only bold / oblique are recognized |
shadow |
false |
1px drop shadow; shadow_outline for all-directions, shadow_color (default black), shadow_x/shadow_y offsets |
case_mode |
0 |
numeric case transform, see below |
underlined / strikethrough
|
false |
decorations |
Multi-line:
| attribute | default | meaning |
|---|---|---|
multi_line |
false |
enable word wrap |
line_maxw |
unlimited | wrap width in pixels, but clamped by the parent's inner width unless multi_line_maxw_only="true"
|
multi_line_space |
8 |
extra pixels between lines |
multi_max_line |
0 = off |
line cap; overflow gets "..." |
justification |
dont_clip_word |
wrap mode: clip_word, dont_clip_word, justified, centered
|
continuous_update |
false |
re-wrap every frame while an ancestor resizer is being dragged |
Single-line overflow handling: auto_clamp shrinks the text to its ancestor's width with "..." (clamp_right picks the end to cut); over_extend_view_text pops the full string in an overlay on hover.
case_mode is a number: 0 normal, 1 lower, 2 UPPER, 3 first letter of the string up, 4 first letter of each sentence up, 5 First Letter Of Each Word Up. The client-style %case_upper names are defines you must declare yourself.
-
text_formatedaddsformat(default"$t"); the format string is expanded by an application-installed formatter (the client substitutes player names and the like). Without a formatter installed the text passes through. -
text_id/text_id_formated: the text comes from a server string id.textidis either a literal id or a database leaf holding one;dynamic_stringselects the dynamic-string table. Requires an application-installed text provider (the client wires the network string cache; a standalone app supplies whatever backs the id → string lookup).
<view type="bitmap" id="b2" texture="w_slot_item.tga" scale="true" w="64" h="64" global_color="false" />| attribute | default | meaning |
|---|---|---|
texture |
— | atlas entry or file name |
color |
white | modulation color |
scale |
false |
stretch to w/h instead of drawing at texture size |
tile |
false |
repeat instead of stretching |
rot |
0 |
quarter turns (0–3) |
flip |
false |
horizontal flip |
align |
bottom-left | letters l r b t, later letters win (e.g. align="tr") |
txtoffsetx/y, txtwidth/height
|
0 / natural | draw a sub-rectangle of the texture |
inherit_gc_alpha |
false |
multiply alpha by the enclosing container's content alpha (fade with the window) |
A blank.tga white texture with scale="true" plus a color is the standard way to draw solid panels and bars; the layout demos on this wiki are built from exactly that.
bitmap_combo is the database-driven cousin: texture/color lists (tx_normal, col_normal, …) indexed by a selected database value, with grid unroll parameters. Specialized for game-state icon strips (equipment slots, tabbed indicators) where the current image is picked from a database leaf.
These bind to interface database leaves and track them automatically. value must be a database path (UI:..., SERVER:..., LOCAL:...); a literal number is a parse error for text_number and digit.
text_number is a CViewText displaying a leaf:
| attribute | default | meaning |
|---|---|---|
value |
required | database leaf |
format |
false |
thousands separators |
divisor / modulo
|
1 / off | display (value/divisor) % modulo
|
prefix / suffix
|
— | literal text around the number |
positive |
false |
negative values display as ?
|
digit is a fixed-width digit display using the renderer's pre-rendered digit textures (the Minesweeper counters): value (leaf), numdigit (1–10, default 2), wspace (per-digit spacing, may be negative), color.
text_quantity displays value/valuemax from two leaves (155/200 style), with emptytext shown when the value is zero.
bar is a gauge with fill ratio = (value − reference) / (range − reference):
<view type="bar" id="g1" value="UI:TEMP:SLIDERH" range="255" color="80 160 255 255" ... />value, range (default 255), reference (default 0) each accept a literal or a database path. mini, ultra_mini, mini_thick switch to the smaller gauge skins; color_negative (when given an alpha) draws negative ratios. The slot and fill textures are hard-coded gauge skin names (w_jauge_*), so the atlas must contain them.
bar3 stacks three segments in one slot: value1..3, range1..3, color1..3, mini.
In
bar3, omitting acolorN_negativeattribute enables negative display in white rather than disabling it (a missing color parses as white). SetcolorN_negative="0 0 0 0"explicitly to disable. {.is-warning}
generic_pointer is the cursor view: one per interface, drawn last. Its tx_* attributes name cursor textures per context (tx_default, tx_move_window, resize variants, tx_colpick, …); x/y are the hotspot offset. If no pointer view is declared the parser creates a bare one automatically. Note the parser only wires a type="pointer" view (a client-registered class) as the pointer, so a type="generic_pointer" element in XML is decorative; rely on the auto-created one or the embedder's registration. See the embedding notes.
Not XML-creatable (script/code only): polygon and quad views, the HTML link view.