SpriteFromSheet Class
Namespace: Stride.Rendering.SpritesAssembly: Stride.Rendering.dll
A sprite provider from a SpriteSheet
[DataContract("SpriteFromSheet")]
[Display("Sprite Group", null)]
public class SpriteFromSheet : IAnimatableSpriteProvider, ISpriteProvider
Name | Description | |
---|---|---|
Properties | ||
CurrentFrame | Gets or sets the current frame of the animation. |
|
Sheet | Gets or sets the Sheet of the provider. |
|
SpritesCount | Gets the number of sprites available in the provider. |
|
Methods | ||
Create(SpriteSheet, String) | Creates a new instance of SpriteFromSheet with the specified SpriteSheet.
CurrentFrame is initialized according to the specified |
|
GetSprite() | Get a sprite from the provider. |
Properties
CurrentFrame
Gets or sets the current frame of the animation.
[DataMember]
[Display("Default Frame", null)]
public int CurrentFrame { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Sheet
Gets or sets the Sheet of the provider.
[DataMember]
public SpriteSheet Sheet { get; set; }
Property Value
Type | Description |
---|---|
SpriteSheet |
SpritesCount
Gets the number of sprites available in the provider.
public int SpritesCount { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
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
Type | Name | Description |
---|---|---|
SpriteSheet | sheet | |
System.String | spriteName | The name of the sprite. |
Returns
Type | Description |
---|---|
SpriteFromSheet |
Remarks
If two sprites have the provided name then the first sprite found is used.
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | sheet |
System.Collections.Generic.KeyNotFoundException | No sprite in the sheet has the given name. |
GetSprite()
Get a sprite from the provider.
public Sprite GetSprite()
Returns
Type | Description |
---|---|
Sprite |