Skip to content

Class SpriteMap<T>

Definition

Namespace: StardewUI.Graphics
Assembly: StardewUI.dll

General implementation of an ISpriteMap<T> that can be prepared in a variety of ways.

public class SpriteMap<T> : StardewUI.Graphics.ISpriteMap<T>

Type Parameters

T
Type of key for which to obtain sprites.

Inheritance
Object ⇦ SpriteMap<T>

Implements
ISpriteMap<T>

Remarks

Can be constructed directly, but it is normally recommended to use SpriteMapBuilder<T>. Applies basic placeholder logic that considers only the defaultSprite to be a placeholder.

Members

Constructors

Name Description
SpriteMap<T>(IReadOnlyDictionary<T, Sprite>, Sprite) General implementation of an ISpriteMap<T> that can be prepared in a variety of ways.

Methods

Name Description
Get(T, Boolean) Gets the sprite corresponding to a particular key.

Details

Constructors

SpriteMap<T>(IReadOnlyDictionary<T, Sprite>, Sprite)

General implementation of an ISpriteMap<T> that can be prepared in a variety of ways.

public SpriteMap<T>(System.Collections.Generic.IReadOnlyDictionary<T, StardewUI.Graphics.Sprite> sprites, StardewUI.Graphics.Sprite defaultSprite);
Parameters

sprites   IReadOnlyDictionary<T, Sprite>
Map of keys to sprites.

defaultSprite   Sprite
Default sprite to show when looking up a key without a corresponding sprite.

Remarks

Can be constructed directly, but it is normally recommended to use SpriteMapBuilder<T>. Applies basic placeholder logic that considers only the defaultSprite to be a placeholder.


Methods

Get(T, Boolean)

Gets the sprite corresponding to a particular key.

public StardewUI.Graphics.Sprite Get(T key, out System.Boolean isPlaceholder);
Parameters

key   T
The key to retrieve.

isPlaceholder   Boolean
true if the returned Sprite is not specific to the key, but is instead a placeholder (border/background) in which some substitute, typically normal text, must be drawn. false if the Sprite is a complete self-contained representation of the key.

Returns

Sprite