Class GorgonSprite
A class that defines a rectangluar region to display a 2D image.
Inherited Members
Namespace: Gorgon.Renderers
Assembly: Gorgon.Renderers.Gorgon2D.dll
Syntax
public class GorgonSprite
Constructors
| Edit this page View SourceGorgonSprite()
Initializes a new instance of the GorgonSprite class.
Declaration
public GorgonSprite()
GorgonSprite(GorgonSprite)
Initializes a new instance of the GorgonSprite class.
Declaration
public GorgonSprite(GorgonSprite clone)
Parameters
Type | Name | Description |
---|---|---|
GorgonSprite | clone | The clone. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the |
Properties
| Edit this page View SourceAbsoluteAnchor
Property to set or return the absolute anchor position.
Declaration
[JsonIgnore]
public Vector2 AbsoluteAnchor { get; set; }
Property Value
Type | Description |
---|---|
Vector2 |
Remarks
Unlike the Anchor property, this value is absolute from the upper left corner of the sprite to the lower right corner.
AlphaTest
Property to set or return the alpha testing values.
Declaration
public GorgonRangeF? AlphaTest { get; set; }
Property Value
Type | Description |
---|---|
GorgonRangeF? |
Remarks
Alpha testing will skip rendering pixels based on the current alpha value for the pixel if it falls into the range specified by this property.
To disable alpha testing outright, set this property to null.
Anchor
Property to set or return the point around which the sprite will pivot when rotated.
Declaration
public Vector2 Anchor { get; set; }
Property Value
Type | Description |
---|---|
Vector2 |
Remarks
This value is a relative value where 0, 0 means the upper left of the sprite, and 1, 1 means the lower right.
Angle
Property to set or return the angle of rotation, in degrees.
Declaration
[JsonIgnore]
public float Angle { get; set; }
Property Value
Type | Description |
---|---|
float |
Bounds
Property to set or return the boundaries of the sprite.
Declaration
[JsonIgnore]
public RectangleF Bounds { get; set; }
Property Value
Type | Description |
---|---|
RectangleF |
Color
Property to set or return the color of the sprite.
Declaration
[JsonIgnore]
public GorgonColor Color { get; set; }
Property Value
Type | Description |
---|---|
GorgonColor |
Remarks
This sets the color for the entire sprite. To assign colors to each corner of the sprite, use the CornerColors property.
CornerColors
Property to return the interface that allows colors to be assigned to each corner of the sprite.
Declaration
public GorgonSpriteColors CornerColors { get; }
Property Value
Type | Description |
---|---|
GorgonSpriteColors |
CornerOffsets
Property to return the interface that allows an offset to be applied to each corner of the sprite.
Declaration
public GorgonRectangleOffsets CornerOffsets { get; }
Property Value
Type | Description |
---|---|
GorgonRectangleOffsets |
Depth
Property to set or return the depth value for this sprite.
Declaration
[JsonIgnore]
public float Depth { get; set; }
Property Value
Type | Description |
---|---|
float |
HorizontalFlip
Property to set or return whether the sprite texture is flipped horizontally.
Declaration
public bool HorizontalFlip { get; set; }
Property Value
Type | Description |
---|---|
bool |
Remarks
This only flips the texture region mapped to the sprite. It does not affect the positioning or axis of the sprite.
IsUpdated
Property to return whether or not the sprite has had its position, size, texture information, or object space vertices updated since it was last drawn.
Declaration
[JsonIgnore]
public bool IsUpdated { get; }
Property Value
Type | Description |
---|---|
bool |
Position
Property to set or return the position of the sprite.
Declaration
[JsonIgnore]
public Vector2 Position { get; set; }
Property Value
Type | Description |
---|---|
Vector2 |
Scale
Property to set or return the scale factor to apply to the sprite.
Declaration
[JsonIgnore]
public Vector2 Scale { get; set; }
Property Value
Type | Description |
---|---|
Vector2 |
ScaledSize
Property to set or return the size of the renderable after scaling has been applied.
Declaration
[JsonIgnore]
public Size2F ScaledSize { get; set; }
Property Value
Type | Description |
---|---|
Size2F |
Remarks
This property will set or return the actual size of the renderable. This means that if a Scale has been set, then this property will return the size of the renderable with multiplied by the scale. When assigning a value, the scale be set on value derived from the current size of the renderable.
Size
Property to set or return the size of the sprite.
Declaration
public Size2F Size { get; set; }
Property Value
Type | Description |
---|---|
Size2F |
Texture
Property to set or return the texture to render.
Declaration
public GorgonTexture2DView Texture { get; set; }
Property Value
Type | Description |
---|---|
GorgonTexture2DView |
TextureArrayIndex
Property to set or return which index within a texture array to use.
Declaration
public int TextureArrayIndex { get; set; }
Property Value
Type | Description |
---|---|
int |
TextureRegion
Property to set or return the region of the texture to use when drawing the sprite.
Declaration
public RectangleF TextureRegion { get; set; }
Property Value
Type | Description |
---|---|
RectangleF |
Remarks
These values are in texel coordinates.
TextureSampler
Property to set or return the texture sampler to use when rendering.
Declaration
public GorgonSamplerState TextureSampler { get; set; }
Property Value
Type | Description |
---|---|
GorgonSamplerState |
VerticalFlip
Property to set or return whether the sprite texture is flipped vertically.
Declaration
public bool VerticalFlip { get; set; }
Property Value
Type | Description |
---|---|
bool |
Remarks
This only flips the texture region mapped to the sprite. It does not affect the positioning or axis of the sprite.
Methods
| Edit this page View SourceCopyTo(GorgonSprite)
Function to copy the sprite data into the specified sprite.
Declaration
public void CopyTo(GorgonSprite sprite)
Parameters
Type | Name | Description |
---|---|---|
GorgonSprite | sprite | The sprite that will receive the data. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the |