Class TextureHandler
The texture handler stores data for the game's textures, including all of the game's internal textures and various utility methods. It also stores the game's MLEM.Data.RuntimeTexturePacker which is used to pack all textures into a big texture for performance.
public static class TextureHandler
- Inheritance
-
TextureHandler
- Inherited Members
Fields
ClothesTextures
public static readonly Dictionary<(string Group, string Texture), Dictionary<Point, TextureRegion>> ClothesTextures
Field Value
- Dictionary<(string Group, string Texture), Dictionary<Point, TextureRegion>>
FurnitureTextures
public static readonly Dictionary<string, TextureRegion> FurnitureTextures
Field Value
- Dictionary<string, TextureRegion>
TexturePacker
public static readonly RuntimeTexturePacker TexturePacker
Field Value
- RuntimeTexturePacker
Properties
AutoTileTexture
public static IReadOnlyDictionary<Point, TextureRegion> AutoTileTexture { get; }
Property Value
- IReadOnlyDictionary<Point, TextureRegion>
CursorTexture
public static UniformTextureAtlas CursorTexture { get; }
Property Value
- UniformTextureAtlas
DefaultEventStings
public static SoundEffect[] DefaultEventStings { get; }
Property Value
- SoundEffect[]
DefaultSounds
public static SoundEffect[] DefaultSounds { get; }
Property Value
- SoundEffect[]
EmoteTexture
public static IReadOnlyDictionary<Point, TextureRegion> EmoteTexture { get; }
Property Value
- IReadOnlyDictionary<Point, TextureRegion>
FenceTextures
public static IReadOnlyDictionary<Point, TextureRegion> FenceTextures { get; }
Property Value
- IReadOnlyDictionary<Point, TextureRegion>
LightTexture
public static UniformTextureAtlas LightTexture { get; }
Property Value
- UniformTextureAtlas
NudityCensor
public static TextureRegion NudityCensor { get; }
Property Value
- TextureRegion
OpeningTexture
public static IReadOnlyDictionary<Point, TextureRegion> OpeningTexture { get; }
Property Value
- IReadOnlyDictionary<Point, TextureRegion>
ParticleTexture
public static IReadOnlyDictionary<Point, TextureRegion> ParticleTexture { get; }
Property Value
- IReadOnlyDictionary<Point, TextureRegion>
RoofTexture
public static IReadOnlyDictionary<Point, TextureRegion> RoofTexture { get; }
Property Value
- IReadOnlyDictionary<Point, TextureRegion>
StairsTextures
public static IReadOnlyDictionary<Point, TextureRegion> StairsTextures { get; }
Property Value
- IReadOnlyDictionary<Point, TextureRegion>
TileScale
The factor that the current textures' tile size is increased or decreased by, based on the default value of 32x16 pixels.
public static float TileScale { get; }
Property Value
TileSize
The size of each tile, in pixels
public static Point TileSize { get; }
Property Value
- Point
TileTexture
public static IReadOnlyDictionary<Point, TextureRegion> TileTexture { get; }
Property Value
- IReadOnlyDictionary<Point, TextureRegion>
UiTexture
public static IReadOnlyDictionary<Point, TextureRegion> UiTexture { get; }
Property Value
- IReadOnlyDictionary<Point, TextureRegion>
VehicleTexture
public static DataTextureAtlas VehicleTexture { get; }
Property Value
- DataTextureAtlas
WallpaperTextures
public static IReadOnlyDictionary<Point, TextureRegion> WallpaperTextures { get; }
Property Value
- IReadOnlyDictionary<Point, TextureRegion>
WaterTexture
public static IReadOnlyDictionary<Point, TextureRegion> WaterTexture { get; }
Property Value
- IReadOnlyDictionary<Point, TextureRegion>
Methods
GetFurnitureTexture(string, bool)
Returns a MLEM.Textures.TextureRegion with the given name, based on all of the textures in the base game and all GetCustomFurnitureTextures(ModInfo) textures.
public static TextureRegion GetFurnitureTexture(string name, bool throwIfNotFound = true)
Parameters
namestringThe name of the texture to get
throwIfNotFoundboolWhether an exception should be thrown if the texture is not found
Returns
- TextureRegion
A texture region with the given name, or null if there is none
GetFurnitureTextures(string, int, Func<Direction2, bool>)
Create a dictionary of textures for all MLEM.Maths.Direction2Helper.Adjacent directions that have a texture registered for them. Textures are gathered using GetCustomFurnitureTextures(ModInfo), and textures need to be suffixed with the direction's string to be recognized. This method is used for furniture of all kinds.
public static IReadOnlyDictionary<Direction2, TextureRegion[]> GetFurnitureTextures(string name, int amount = 1, Func<Direction2, bool> shouldThrow = null)
Parameters
namestringThe name of the texture to load
amountintThe amount of layers the texture has
shouldThrowFunc<Direction2, bool>Whether an exception should be thrown if the texture is not found
Returns
- IReadOnlyDictionary<Direction2, TextureRegion[]>
A dictionary of directions to texture layers
Events
OnGameContentLoaded
An event that is invoked when the base game has just loaded a Microsoft.Xna.Framework.Graphics.Texture2D through a Microsoft.Xna.Framework.Content.ContentManager. This event can be used by mods to change what textures the game uses.
public static event TextureHandler.GameContentLoadedDelegate OnGameContentLoaded
Event Type
OnLoadGameContent
An event that is invoked when the base game loads textures to be packed or otherwise used. This event can be used by mods to change what textures the game uses by changing the Microsoft.Xna.Framework.Content.ContentManager and/or the path of the texture to load.
public static event TextureHandler.LoadGameContentDelegate OnLoadGameContent