tModLoader v2024.11
A mod to make and play Terraria mods
BossBarLoader Class Reference

Static Public Member Functions

static void DrawFancyBar_TML (SpriteBatch spriteBatch, BossBarDrawParams drawParams)
 Draws a healthbar with fixed barTexture dimensions (516x348) where the effective bar top left starts at 32x24, and is 456x22 big More...
 
static Asset< Texture2D > GetTexture (ModBossBar bossBar)
 Returns the texture that the given bar is using. If it does not have a custom one, it returns the vanilla texture More...
 
static bool NpcToBossBar (NPC npc, out ModBossBar value)
 Gets the ModBossBar associated with this NPC More...
 
static void PostDraw (SpriteBatch spriteBatch, BigProgressBarInfo info, BossBarDrawParams drawParams)
 
static bool PreDraw (SpriteBatch spriteBatch, BigProgressBarInfo info, ref BossBarDrawParams drawParams)
 

Properties

static ModBossBarStyle CurrentStyle = vanillaStyle [get]
 
static Asset< Texture2D > VanillaBossBarTexture [get]
 

Member Function Documentation

◆ DrawFancyBar_TML()

static void BossBarLoader.DrawFancyBar_TML ( SpriteBatch  spriteBatch,
BossBarDrawParams  drawParams 
)
static

Draws a healthbar with fixed barTexture dimensions (516x348) where the effective bar top left starts at 32x24, and is 456x22 big

The icon top left starts at 4x20, and is 26x28 big

Frame 0 contains the frame (outline)

Frame 1 contains the 2 pixel wide strip for the tip of the bar itself

Frame 2 contains the 2 pixel wide strip for the bar itself, stretches out

Frame 3 contains the background

Frame 4 contains the 2 pixel wide strip for the tip of the bar itself (optional shield)

Frame 5 contains the 2 pixel wide strip for the bar itself, stretches out (optional shield)

Supply your own textures if you need a different shape/color, otherwise you can make your own method to draw it

Parameters
spriteBatchThe spriteBatch that is drawn on
drawParamsThe draw parameters for the boss bar

◆ GetTexture()

static Asset< Texture2D > BossBarLoader.GetTexture ( ModBossBar  bossBar)
static

Returns the texture that the given bar is using. If it does not have a custom one, it returns the vanilla texture

Parameters
bossBarThe ModBossBar
Returns
Its texture, or the vanilla texture

◆ NpcToBossBar()

static bool BossBarLoader.NpcToBossBar ( NPC  npc,
out ModBossBar  value 
)
static

Gets the ModBossBar associated with this NPC

Parameters
npcThe NPC
valueWhen this method returns, contains the ModBossBar associated with the specified NPC
Returns
true if a ModBossBar is assigned to it; otherwise, false.