Sprite
Declaration
public class Strawberry.Graphics.Sprite
Represents a 2D sprite with texture mapping and frame information.
Inherits: Strawberry.ReferenceObject
Constructors
Sprite
void Sprite(Texture texture, int imageCount, Vector2 size, Vector2 topLeft, Vector2 texSize, Vector2 skip)
Parameters:
| Name | Type | Description |
|---|---|---|
texture |
Strawberry.Graphics.Texture |
|
imageCount |
System.Int32 |
|
size |
Strawberry.Math.Vector2 |
|
topLeft |
Strawberry.Math.Vector2 |
|
texSize |
Strawberry.Math.Vector2 |
|
skip |
Strawberry.Math.Vector2 |
Sprite
void Sprite(Texture texture, Vector2[] imageMap, Vector2 size, Vector2 texSize)
Parameters:
| Name | Type | Description |
|---|---|---|
texture |
Strawberry.Graphics.Texture |
|
imageMap |
Strawberry.Math.Vector2[] |
|
size |
Strawberry.Math.Vector2 |
|
texSize |
Strawberry.Math.Vector2 |
Properties
Position
Vector2 Position { get set }
Texture
Gets or sets texture that this sprite is using for rendering.
Texture Texture { get set }
ImageCount
Gets the number of images or frames in the sprite sheet.
int ImageCount { get }
TopLeft
Gets the top-left corner coordinates of the sprite within the texture.
Vector2 TopLeft { get }
TexSize
Gets the width and height of the sprite within the texture.
Vector2 TexSize { get }
Skip
Gets the number of pixels to skip between each frame in the sprite sheet
Vector2 Skip { get }
Size
Gets or sets actual size of the sprite in 2D space
Vector2 Size { get set }
FrameMap
Gets the positions of each frame in the sprite sheet, relative to the top-left corner
List<Vector2> FrameMap { get set }
Methods
ReInitialize
void ReInitialize(Texture texture, Vector2[] imageMap, Vector2 size, Vector2 texSize)
Parameters:
| Name | Type | Description |
|---|---|---|
texture |
Strawberry.Graphics.Texture |
|
imageMap |
Strawberry.Math.Vector2[] |
|
size |
Strawberry.Math.Vector2 |
|
texSize |
Strawberry.Math.Vector2 |