adjustedhudwidth

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;
  }

This article is issued from Zdoom. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.