Skip to content

SpriteComponent Class

Definition

Namespace: Brine2D.Systems.Rendering

Component for sprite rendering data. Contains all information needed to render a sprite. Rendering logic is handled by SpriteRenderingSystem with batching.

C#
public class SpriteComponent : Brine2D.ECS.Component

Inheritance System.ObjectComponent → SpriteComponent

Properties
BlendMode Blend mode used when rendering this sprite. Defaults to standard alpha blending.
CrossFadeGhosts Outgoing cross-fade ghosts, one per concurrent fade \(base animator \+ each layer\). Rendered by SpriteRenderingSystem as additional draw calls at fading-out opacity, producing true multi-source cross-fade blends. Set and cleared automatically by AnimationSystem.
FlipX Whether to flip the sprite horizontally.
FlipY Whether to flip the sprite vertically.
Layer Rendering layer/order \(higher = drawn on top\). Used by the batching system to sort sprites.
Material Optional custom material for this sprite. Stored for use by custom render systems; the built-in SpriteRenderingSystem does not yet switch pipelines based on this value.
Offset Draw offset from transform position \(in pixels\).
OrderInLayer Secondary sort key within a layer. Sprites with a lower value are drawn first \(behind\). Use this for Y-sorting in top-down games or to control overlap within the same layer.
Origin Origin/pivot point \(0–1 range\). Defaults to center. Overridden each frame by AnimationSystem when an AnimatorComponent is present.
Scale Scale multiplier applied on top of the entity's TransformComponent scale. Supports non-uniform \(squash\-and\-stretch\) scaling per axis.
SourceRect Source rectangle in the texture \(null = entire texture\). Use this for sprite sheets and texture atlases.
Texture Loaded texture reference \(set by SpriteRenderingSystem\).
TexturePath Path to the texture \(for loading\).
TextureScaleMode Texture filtering mode used when this sprite's texture is auto-loaded via LoadTexturesAsync\(IEntityWorld, CancellationToken\). Defaults to Nearest for pixel-art friendliness. Has no effect when Texture is assigned directly.
Tint Tint color applied to the sprite.