These function enable true widescreen support in HUD scripts.
Actual screen boundaries in widescreen are outside the HUD coordinate system's rectangle. These functions can calculate true screen boundaries in HUD coordinate system.
void HudSetVirtualSize(fixed width, fixed height)
Sets the HUD Library's HUD coordinate system size. Default is 640×480. After that, actual screen boundaries in HUD coordinate system for current aspect ratio can be retrieved using the following functions:
fixed HudX1()
or fixed HudLeft()
– left boundaryfixed HudX2()
or fixed HudRight()
– right boundaryfixed HudY1()
or fixed HudTop()
– top boundaryfixed HudY2()
or fixed HudBottom()
– bottom boundaryExample:
// draw this item in the upper left corner of the screen // uses 640x480 HUD coordinate system DRAW_ITEM(HudTop(), HudLeft());
Screen boundaries in current aspect ratio can be calculated for any HUD coordinate system size without calling HudSetVirtualSize
:
fixed HudX1For(fixed width)
or fixed HudLeftFor(fixed width)
– left boundary for given HUD coordinate system width.fixed HudX2For(fixed width)
or fixed HudRightFor(fixed width)
– right boundary for given HUD coordinate system width.fixed HudY1For(fixed height)
or fixed HudTopFor(fixed height)
– top boundary for given HUD coordinate system height.fixed HudY2For(fixed height)
or fixed HudBottomFor(fixed height)
– bottom boundary for given HUD coordinate system height.