Skip to main content

Resource Bars

Resource bars are embedded in the bars field of a resource definition. A single resource can render differently in multiple contexts, so you do not need a separate file for each bar.

FieldTypeRequiredDefaultDescription
contextContext IDno"saturn:self_hud"A string ID, not a type object.
anchorStringyes—left or right.
orderIntegerno0Layout order within the same context.
visibilityVisibilityno{"type":"saturn:always"}Whether to draw the bar.
rendererRenderer typeyes—Appearance of the resource bar.
value_displayStringno"none"none, current, current_and_maximum, percentage.
maximumNumbernoomittedA positive number overrides the displayed maximum; a non-positive number is treated as unspecified.

Example​

{
"context": "saturn:self_hud",
"anchor": "left",
"order": 0,
"visibility": {
"type": "saturn:always"
},
"renderer": {
"type": "saturn:segmented_bar",
"segments": 10
},
"value_display": "current_and_maximum"
}

Texture format​

The SpriteIcon fields of renderers accept either an ID or an object. A bare ID in textured_bar means a GUI atlas sprite, while a bare ID in the sprite_location of boss_bar means a full texture. The object format is as follows:

FieldTypeRequiredDefaultDescription
spriteResource IDone of twoomittedGUI atlas sprite; cannot be specified together with texture.
textureResource IDone of twoomittedPath to a full texture.
regionRegion objectnoomittedOnly available with texture.
width / heightIntegerno0When both are 0, the caller's size is used; if specified, both must be given, in the range 0–8192.
region.u / region.vIntegerno0Origin of the texture region, in the range 0–8192.
region.texture_width / region.texture_heightIntegerno256Size of the source texture, in the range 1–8192.
{
"texture": "example:textures/gui/bar.png",
"region": {
"u": 0,
"v": 0,
"texture_width": 256,
"texture_height": 256
},
"width": 81,
"height": 9
}