-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathSprite.cs
32 lines (29 loc) · 1.02 KB
/
Sprite.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
namespace OpenWheels.Rendering
{
/// <summary>
/// A sprite value type, represented with a texture identifier and a source rectangle (in pixels) in the texture.
/// </summary>
public struct Sprite
{
/// <summary>
/// Texture identifier.
/// </summary>
public readonly int Texture;
/// <summary>
/// Source rectangle of the sprite in the texture in pixels.
/// </summary>
public readonly Rectangle SrcRect;
/// <summary>
/// Create a new Sprite.
/// </summary>
/// <param name="texture">The texture identifier.</param>
/// <param name="srcRect">The source rectangle of the sprite in pixels.</param>
public Sprite(int texture, Rectangle srcRect)
{
Texture = texture;
SrcRect = srcRect;
}
public override string ToString()
=> $"{nameof(Texture)}: {Texture}, {nameof(SrcRect)}: {SrcRect}";
}
}