TextureAtlas

Namespace: Murder.Core.Graphics
Assembly: Murder.dll

public class TextureAtlas : IDisposable

A texture atlas, the texture2D can be loaded and unloaded from the GPU at any time We will keep the texture lists in memory all the time, though.

Implements: IDisposable

⭐ Constructors

public TextureAtlas(string name, AtlasId id)

Parameters
name string
id AtlasId

⭐ Properties

CountEntries

public int CountEntries { get; }

Returns
int

Id

public readonly AtlasId Id;

Returns
AtlasId

Name

public readonly string Name;

Returns
string

⭐ Methods

Get(string)

public AtlasCoordinates Get(string id)

Parameters
id string

Returns
AtlasCoordinates

HasId(string)

public bool HasId(string id)

Parameters
id string

Returns
bool

TryCreateTexture(string, out Texture2D&)

public bool TryCreateTexture(string id, Texture2D& texture)

Parameters
id string
texture Texture2D&

Returns
bool

TryGet(string, out AtlasCoordinates&)

public bool TryGet(string id, AtlasCoordinates& coord)

Parameters
id string
coord AtlasCoordinates&

Returns
bool

GetAllEntries()

public IEnumerable<T> GetAllEntries()

Returns
IEnumerable<T>

CreateTextureFromAtlas(AtlasCoordinates, SurfaceFormat, float)

public Texture2D CreateTextureFromAtlas(AtlasCoordinates textureCoord, SurfaceFormat format, float scale)

This creates a new texture on the fly and should be AVOIDED!. Use Get instead.

Parameters
textureCoord AtlasCoordinates

format SurfaceFormat

scale float

Returns
Texture2D

CreateTextureFromAtlas(string)

public Texture2D CreateTextureFromAtlas(string id)

This creates a new texture on the fly and should be AVOIDED!. Use Get instead.

Parameters
id string

Returns
Texture2D

Dispose()

public virtual void Dispose()

LoadTextures()

public void LoadTextures()

PopulateAtlas(IEnumerable)

public void PopulateAtlas(IEnumerable<T> entries)

Parameters
entries IEnumerable<T>

UnloadTextures()

public void UnloadTextures()