UI Frame Definition File (FDF)
FDF (Frame Definition File) is a plain-text declarative format used by Warcraft III to describe the UI frame hierarchy — positions, sizes, textures, fonts, and child frames. OpenWarcraft3 parses FDF files on the server at startup to build the UI template registry.
File Format
FDF files are hierarchical blocks enclosed in braces. The general form is:
FrameType "FrameName" {
InheritsParts "BaseName"
Width 0.025
Height 0.025
SetPoint TOPLEFT, TOPLEFT, 0.005, -0.005
BackdropTileBackground false
BackdropBackground "path\\to\\background.blp"
...
ChildFrame {
...
}
}
Frame Types
The following frame types are recognised by the parser (game/ui/ui_fdf.c):
| Type | Purpose |
|---|---|
BACKDROP |
Textured rectangle background |
BUTTON |
Clickable button with up/down/hover states |
CHATDISPLAY |
Scrolling chat log area |
CHECKBOX |
Toggleable checkbox |
DIALOG |
Modal dialog container |
EDITBOX |
Single-line text input |
FRAME |
Generic container |
GLUEBUTTON |
Menu/glue screen button |
GLUECHECKBOX |
Menu/glue screen checkbox |
GLUEEDITBOX |
Menu/glue screen text input |
GLUETEXTBUTTON |
Menu/glue screen text button |
HIGHLIGHT |
Highlight overlay |
LISTBOX |
Scrollable list |
MODEL |
Inline 3D model viewer |
POPUPMENU |
Drop-down menu |
SCROLLBAR |
Scroll bar control |
SIMPLEBUTTON |
Lightweight button |
SIMPLEFRAME |
Lightweight container |
SLIDER |
Numeric slider |
SPRITE |
Animated texture |
TEXT |
Static or dynamic text label |
TEXTAREA |
Multi-line text area |
TIMEDTEXTFRAME |
Timed-display text |
Common Properties
| Property | Description |
|---|---|
Width <float> |
Frame width as a fraction of the screen width |
Height <float> |
Frame height as a fraction of the screen height |
SetPoint <anchor>, <target>, <x>, <y> |
Attach a frame anchor to a parent anchor with an offset |
SetAllPoints |
Stretch to fill the parent |
InheritsParts "Name" |
Copy all properties from the named base template |
BackdropBackground "path" |
Texture path for the backdrop |
BackdropTileBackground <bool> |
Tile the texture instead of stretching |
BackdropEdgeFile "path" |
Texture for the nine-slice border edges |
BackdropEdgeSize <float> |
Width of the border region |
FontString <font>, <height>, <flags> |
Text font and size |
Text "<string>" |
Default text content |
Color <r> <g> <b> <a> |
RGBA vertex colour (0–255 each) |
Anchor Points
SetPoint accepts one of nine named anchor points:
TOPLEFT, TOP, TOPRIGHT, LEFT, CENTER, RIGHT, BOTTOMLEFT, BOTTOM, BOTTOMRIGHT
The offset is specified in screen-width fractions:
This aligns the frame's top-left corner 2% from the screen left edge and 2% from the top.
Frame Registry
UI_ParseFDF (game/ui/ui_fdf.c) tokenises the FDF text, constructs frameDef_t structs, and stores them in the global frame registry keyed by name. The registry is queried at UI layout time to instantiate concrete uiFrame_t objects.
Programmatic API
Frames can also be created directly in C without any FDF text using the API described in ui_fdf.c:
FRAMEDEF f;
UI_InitFrame(&f, FT_TEXT);
UI_SetPoint(&f, FRAMEPOINT_TOPLEFT, NULL, FRAMEPOINT_TOPLEFT, 0.05, -0.30);
UI_SetText(&f, "Hello, world!");
UI_WriteFrame(&f);
Helper functions:
| Function | Purpose |
|---|---|
UI_InitFrame(frame, type) |
Zero-initialise and set the frame type |
UI_SetPoint(frame, point, rel, targetPoint, x, y) |
Anchor a point to a relative frame |
UI_SetSize(frame, width, height) |
Set explicit dimensions |
UI_SetText(frame, fmt, ...) |
Printf-style text assignment |
UI_SetTexture(frame, name, decorate) |
Assign a texture by skin-entry name |
UI_SetParent(frame, parent) |
Attach to a parent frame |
UI_WriteFrame(frame) |
Emit one frame into the svc_layout message |
UI_WriteFrameWithChildren(frame, parent) |
Emit a frame and its entire sub-tree |
See game/hud/ui_log.c for a worked example.
Related Source Files
| Source | Purpose |
|---|---|
game/ui/ui_fdf.c |
FDF text parser and programmatic frame API |
game/ui/ui_init.c |
UI_Init — loads FDF assets and builds the initial layout |
game/ui/ui_write.c |
UI_WriteLayout — serialises the frame tree to clients |
client/cl_parse.c |
CL_ParseLayout — receives and stores serialised UI |
common/msg.c |
uiFrameFields[] — delta-encoded wire field list |