HUD

The Modding Book chapter provides a good guide: https://rubenwardy.com/minetest_modding_book/en/chapters/hud.html

Methods

 * Shows a HUD element to the Player
 * Changes a HUD element shown to the Player
 * Removes a HUD element shown to the Player
 * Gets a HUD element definition
 * Sets specified HUD flags to true/false
 * flags: (is visible) hotbar, healthbar, crosshair, wielditem
 * pass a table containing a true/false value of each flag to be set or unset


 * Returns a table containing the status of HUD flags
 * Set number of items in builtin hotbar


 * Sets background image for hotbar
 * Sets image for hotbar selected item
 * Replace the definition of a builtin HUD element

Fields

 * 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. 0 means left/top, 1 means right/bottom.
 * The direction in which something is drawn. 0 is left to right, 1 is right to left, 2 is top to bottom, 3 is bottom to top.
 * UNUSED A description of what the HUD element represents
 * Specifies how the item will be aligned. It ranges from -1 to 1, with 0 being the center, -1 is moved to the left/up, and 1 is to the right/down. Fractional values can be used.
 * Specifies a pixel offset from the position. Not scaled to the screen size.

Types

 * Displays an image on the HUD.
 * 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)
 * The name of the texture that is displayed
 * The alignment of the image
 * Offset in pixels from position
 * Offset in pixels from position


 * Displays text on the HUD.
 * Defines the bounding rectangle of the text. A value such as {x=100, y=100} should work.Negative values represent that percentage of the screen it should take; e.g. x=-100 means 100% (width)
 * The text to be displayed in the HUD element.
 * An integer containing the RGB color value of the text. Specify 0x00FF00 for green text, 0xFF0000 for red and so on.
 * The alignment of the text
 * Offset in pixels from position
 * Offset in pixels from position


 * Displays a horizontal bar made up of half-images.
 * The name of the texture that is used.
 * The number of half-textures that are displayed. If odd, will end with a vertically center-split texture.
 * Offset in pixels from position
 * If used will force full-image size to this value (override texture pack image size)
 * Offset in pixels from position
 * If used will force full-image size to this value (override texture pack image size)


 * The name of the inventory list to be displayed.
 * Number of items in the inventory to be displayed.
 * Position of item that is selected.
 * Position of item that is selected.


 * Displays distance to selected world position.
 * The name of the waypoint.
 * Distance suffix. Can be blank.
 * An integer containing the RGB value of the color used to draw the text.
 * World position of the waypoint.
 * World position of the waypoint.