SpriteRenderer
Namespace: MonineEngine.Graphics
Renders a texture on the position, with the given texture and colour.
public class SpriteRenderer : MonineEngine.Core.Component
Inheritance Object → Component → SpriteRenderer
Attributes NullableContextAttribute, NullableAttribute
Fields
Sprite
Gets or sets the sprite to render. If null, no rendering is attempted.
public Sprite Sprite;
Color
Gets or sets the colour of the texture. Acts as a tint, with white showing the plain texture.
public Color Color;
FlipOnNegativeScale
Gets or sets a value that dictates if the sprite should be flipped on negative scales. Defaults to true.
public bool FlipOnNegativeScale;
Remarks:
This is calculated by taking the scale of SpriteRenderer.Sprite and the scale of the .
Properties
Enabled
public bool Enabled { get; set; }
Property Value
Entity
public Entity Entity { get; internal set; }
Property Value
Entity
Parent
public Entity Parent { get; }
Property Value
Entity
Transform
public Transform Transform { get; }
Property Value
Transform
Camera
public Camera2D Camera { get; }
Property Value
Camera2D
Constructors
SpriteRenderer(Sprite, Color)
Creates a new renderer with the specified SpriteRenderer.Sprite and Color.
public SpriteRenderer(Sprite sprite, Color color)
Parameters
sprite Sprite
The SpriteRenderer.Sprite for the renderer.
color Color
The Color of the renderer.
SpriteRenderer(Sprite)
Creates a new renderer with the specified SpriteRenderer.Sprite, and white as the colour.
public SpriteRenderer(Sprite sprite)
Parameters
sprite Sprite
The SpriteRenderer.Sprite for the renderer.
Methods
Draw(GameTime)
public void Draw(GameTime gameTime)
Parameters
gameTime GameTime