Table of Contents

Class SpriteFromSheet

Namespace
Stride.Rendering.Sprites
Assembly
Stride.Rendering.dll

A sprite provider from a SpriteSheet

[DataContract("SpriteFromSheet")]
[Display("Sprite Group", null)]
public class SpriteFromSheet : IAnimatableSpriteProvider, ISpriteProvider
Inheritance
SpriteFromSheet
Implements

Properties

CurrentFrame

Gets or sets the current frame of the animation.

[DataMember]
[Display("Default Frame", null)]
public int CurrentFrame { get; set; }

Property Value

int

Sheet

Gets or sets the Sheet of the provider.

[DataMember]
public SpriteSheet Sheet { get; set; }

Property Value

SpriteSheet

SpritesCount

Gets the number of sprites available in the provider.

public int SpritesCount { get; }

Property Value

int

Methods

Create(SpriteSheet, string)

Creates a new instance of SpriteFromSheet with the specified SpriteSheet. CurrentFrame is initialized according to the specified spriteName.

public static SpriteFromSheet Create(SpriteSheet sheet, string spriteName)

Parameters

sheet SpriteSheet
spriteName string

The name of the sprite.

Returns

SpriteFromSheet

Remarks

If two sprites have the provided name then the first sprite found is used.

Exceptions

ArgumentNullException

sheet

KeyNotFoundException

No sprite in the sheet has the given name.

GetSprite()

Get a sprite from the provider.

public Sprite GetSprite()

Returns

Sprite