SetHudClipRect

From ZDoom Wiki
Jump to: navigation, search

void SetHUDClipRect (int x, int y, int width, int height [, int wrapwidth]);
void SetHUDClipRect (int x, int y, int width, int height [, int wrapwidth [, bool aspectratio]]); (New from 2.8.1)

Usage

Set the clipping rectangle for future HUD messages. If you do not specify wrapwidth, the HUD message will be laid out as normal, but pixels outside the rectangle will not be drawn. If you specify wrapwidth, then the message will be wrapped to that width. Use SetHUDClipRect(0, 0, 0, 0, 0) to reset everything back to normal. Coordinates for consecutive HUD messages are treated the same.

Parameters

  • x
The X coordinate at which the clipping rectangle starts.
  • y
The Y coordinate at which the clipping rectangle starts.
  • width
The width of the clipping rectangle.
  • height
The height of the clipping rectangle.
  • wrapwidth
Wraps text to this amount of pixels, starting at x. If set to 0, the default wrapping method will take place instead.
Default is 0.
  • aspectratio (New from 2.8.1)
If set to true, it forces the clipping rectangle to assume a 4:3 aspect ratio if the user's current aspect ratio is 16:9 or 16:10. If set to false, however, the user's current aspect ratio is used, instead.
Default is true.

Examples

script 1 ENTER
{
   while(true)
   {
      SetHudClipRect(100, 100, 100, 100, 100);
      HudMessage(s:"cool hud message text goes here, and will be wrapped."; HUDMSG_PLAIN, 10, CR_WHITE, 100, 100, 0.1);
      SetHudClipRect(0, 0, 0, 0);
      Delay(1);
   }
}