From ZDoom Wiki
Jump to navigation Jump to search

This function will return an adjusted width value for a given height value depending on the users screen settings. This is useful for maintaining continuity in size across a variety of screen resolutions and aspect ratios. It can also be useful for tracking screen dimensions for controlling things such as boundaries for mouse navigated menus.

  function int AdjustedHUDWidth (int hud_height)
     int width, height;
     hud_height <<= 16;
     width = GetScreenWidth() << 16;
     height = GetScreenHeight() << 16;
     return FixedMul(hud_height, FixedDiv(width, height)) >> 16;