HUD coordinate system

ZDoom uses a special coordinate system for HudMessages. In 4:3 resolutions, the coordinate system's rectangle matches that of the screen. In aspect ratios other than that, a 4:3 rectangle is put at the center of the screen and the remaining screen space is out of its boundaries.

The HUD coordinate system's rectangle width and height are specified in SetHudSize.

ACSUtils provides functions to correctly work with the HUD coordinate system.

Retrieve aspect ratio

GetAspectRatio returns the aspect ratio that ZDoom assumes the screen is. ZDoom uses tricky code for that.

Actual screen boundaries

HudLeftFor, HudRightFor, HudTopFor and HudBottomFor return actual screen boundaries in the HUD coordinate system for the specified width and height of the HUD coordinate system, taking the current aspect ratio into account.

To avoid specifying a width or height every time, you can call HudSetVirtualSize once and then call HudLeft, HudRight, HudTop and HudBottom.