HUD

HUD element types

The position field is used for all element types.

To account for differing resolutions, the position coordinates are the percentage of the screen, ranging in value from 0 to 1.

The name field is not yet used, but should contain a description of what the HUD element represents. The direction field is the direction in which something is drawn.

0 draws from left to right, 1 draws from right to left, 2 draws from top to bottom, and 3 draws from bottom to top.

The alignment field specifies how the item will be aligned. It is a table where x and y range from -1 to 1, with 0 being central. -1 is moved to the left/up, and 1 is to the right/down. Fractional values can be used.

The offset field specifies a pixel offset from the position. Contrary to position, the offset is not scaled to screen size. This allows for some precisely positioned items in the HUD.

Note: offset will adapt to screen DPI as well as user defined scaling factor!

Below are the specific uses for fields in each type; fields not listed for that type are ignored.

image

Displays an image on the HUD.

  • scale: The scale of the image, with 1 being the original texture size. Only the X coordinate scale is used (positive values). Negative values represent that percentage of the screen it should take; e.g. x=-100 means 100% (width).
  • text: The name of the texture that is displayed.
  • alignment: The alignment of the image.
  • offset: offset in pixels from position.

text

Displays text on the HUD.

  • scale: Defines the bounding rectangle of the text. A value such as {x=100, y=100} should work.
  • text: The text to be displayed in the HUD element.
  • number: An integer containing the RGB value of the color used to draw the text. Specify 0xFFFFFF for white text, 0xFF0000 for red, and so on.
  • alignment: The alignment of the text.
  • offset: offset in pixels from position.

statbar

Displays a horizontal bar made up of half-images.

  • text: The name of the texture that is used.
  • number: The number of half-textures that are displayed. If odd, will end with a vertically center-split texture.
  • direction
  • offset: offset in pixels from position.
  • size: If used, will force full-image size to this value (override texture pack image size)

inventory

  • text: The name of the inventory list to be displayed.
  • number: Number of items in the inventory to be displayed.
  • item: Position of item that is selected.
  • direction
  • offset: offset in pixels from position.

waypoint

Displays distance to selected world position.

  • name: The name of the waypoint.
  • text: Distance suffix. Can be blank.
  • number: An integer containing the RGB value of the color used to draw the text.
  • world_pos: World position of the waypoint.