tModLoader v2024.03
A mod to make and play Terraria mods
BackgroundTextureLoader Class Reference

This is the class that keeps track of all modded background textures and their slots/IDs. Remember that unless you manually register backgrounds via AddBackgroundTexture(Mod, string), only files found in a folder or subfolder of a folder named "Backgrounds" will be autoloaded as background textures. More...

Inherits Loader.

Static Public Member Functions

static void AddBackgroundTexture (Mod mod, string texture)
 Adds a texture to the list of background textures and assigns it a background texture slot. Use this for any background textures not autoloaded by the Mod.BackgroundAutoloadingEnabled logic. More...
 
static int GetBackgroundSlot (Mod mod, string texture)
 Returns the slot/ID of the background texture with the given mod and path. Throws exceptions on failure.
 
static int GetBackgroundSlot (string texture)
 Returns the slot/ID of the background texture with the given full path. The path must be prefixed with a mod name. Throws exceptions on failure.
 
static bool TryGetBackgroundSlot (Mod mod, string texture, out int slot)
 Safely attempts to output the slot/ID of the background texture with the given mod and path.
 
static bool TryGetBackgroundSlot (string texture, out int slot)
 Safely attempts to output the slot/ID of the background texture with the given full path. The path must be prefixed with a mod name.
 

Detailed Description

This is the class that keeps track of all modded background textures and their slots/IDs.

Remember that unless you manually register backgrounds via AddBackgroundTexture(Mod, string), only files found in a folder or subfolder of a folder named "Backgrounds" will be autoloaded as background textures.

Member Function Documentation

◆ AddBackgroundTexture()

static void BackgroundTextureLoader.AddBackgroundTexture ( Mod  mod,
string  texture 
)
static

Adds a texture to the list of background textures and assigns it a background texture slot. Use this for any background textures not autoloaded by the Mod.BackgroundAutoloadingEnabled logic.

Parameters
modThe mod that owns this background.
textureThe texture.