Gondwana Game Engine Development (master) - 2.6.1
Gondwana is a cross-platform 2.5D game and rendering engine written in C#/.NET 8. It provides fine-grained control over rendering, timing, and scene composition, with built-in support for parallax, z-ordering, pixel overhang, collision detection, and particle effects. Gondwana targets desktop and web platforms using SkiaSharp for graphics and pluggable audio backends for desktop and browser targets.
Loading...
Searching...
No Matches
Gondwana.Drawing.Sprites.SpriteManager Class Referencesealed

Manages the lifecycle, lookup, and per-frame updates of all active Sprite instances. More...

Inheritance diagram for Gondwana.Drawing.Sprites.SpriteManager:

Public Member Functions

Sprite CreateSprite (SceneLayer sceneLayer, Frame frame, string? id=null, string? collisionProfileName=null)
 Creates a new sprite on the specified scene layer with the given frame.
Sprite CloneSprite (Sprite sprite)
 Creates a copy of the specified sprite, preserving its current scene layer.
Sprite CloneSprite (Sprite sprite, SceneLayer sceneLayer)
 Creates a clone of the specified sprite on the given scene layer.
Sprite? CloneSprite (string id, SceneLayer sceneLayer)
 Creates a clone of the sprite with the specified ID on the given scene layer.
void Remove (Sprite sprite)
 Removes and disposes the specified sprite.
void Remove (string ID)
 Removes and disposes the sprite with the specified ID.
void Clear ()
 Removes and disposes all sprites currently managed by the sprite manager.
Sprite? GetSpriteByID (string ID)
 Retrieves a sprite by its ID/nickname.
List< Sprite > GetSpritesInWorldRectRange (Rectangle worldRect, SceneLayer? sceneLayer=null, bool fullEnclosures=false)
 Gets all sprites within the specified world rectangle range.
List< Sprite > GetSpritesInViewRectRange (View view, Rectangle viewRectPx, SceneLayer? sceneLayer=null, bool fullEnclosures=false)
 Gets all sprites within the specified view rectangle range.
List< Sprite > GetSpritesAtViewPixel (View view, Point viewPxlPt, SceneLayer? sceneLayer=null)
 Gets all sprites at the specified view pixel coordinate.
void Dispose ()
 Releases all sprites currently managed by this instance.

Properties

static SpriteManager Instance [get]
 Gets the singleton instance of the sprite manager.
ReadOnlyCollection< Sprite > AllSprites [get]
 Gets a read-only collection of all sprites currently managed by the sprite manager.
bool SizeNewSpritesToSceneLayer = true [get, set]
 Gets or sets a value indicating whether new sprites should be automatically sized to their scene layer.
string DefaultCollisionProfile [get, set]
 Gets or sets the scene collision profile assigned to newly created sprites when no profile is specified explicitly.

Events

Action< Sprite >? SpriteCreated
 Event raised when a new sprite is created.

Detailed Description

Manages the lifecycle, lookup, and per-frame updates of all active Sprite instances.

Definition at line 14 of file SpriteManager.cs.

Member Function Documentation

◆ Clear()

void Gondwana.Drawing.Sprites.SpriteManager.Clear ( )

Removes and disposes all sprites currently managed by the sprite manager.

Definition at line 161 of file SpriteManager.cs.

◆ CloneSprite() [1/3]

Sprite Gondwana.Drawing.Sprites.SpriteManager.CloneSprite ( Sprite sprite)

Creates a copy of the specified sprite, preserving its current scene layer.

Parameters
spriteThe sprite to clone. Cannot be null.
Returns
A new Sprite instance that is a copy of the specified sprite, assigned to the same scene layer.

◆ CloneSprite() [2/3]

Sprite Gondwana.Drawing.Sprites.SpriteManager.CloneSprite ( Sprite sprite,
SceneLayer sceneLayer )

Creates a clone of the specified sprite on the given scene layer.

Parameters
spriteThe sprite to clone.
sceneLayerThe scene layer for the cloned sprite.
Returns
The cloned sprite.

Definition at line 114 of file SpriteManager.cs.

◆ CloneSprite() [3/3]

Sprite? Gondwana.Drawing.Sprites.SpriteManager.CloneSprite ( string id,
SceneLayer sceneLayer )

Creates a clone of the sprite with the specified ID on the given scene layer.

Parameters
idThe ID/nickname of the sprite to clone.
sceneLayerThe scene layer for the cloned sprite.
Returns
The cloned sprite, or null if no sprite with the specified ID exists.

Definition at line 128 of file SpriteManager.cs.

◆ CreateSprite()

Sprite Gondwana.Drawing.Sprites.SpriteManager.CreateSprite ( SceneLayer sceneLayer,
Frame frame,
string? id = null,
string? collisionProfileName = null )

Creates a new sprite on the specified scene layer with the given frame.

Parameters
sceneLayerThe scene layer on which to create the sprite.
frameThe frame to use for the sprite.
idOptional nickname/identifier for the sprite.
collisionProfileNameOptional scene collision profile. When omitted, DefaultCollisionProfile is used.
Returns
The newly created sprite.

Definition at line 85 of file SpriteManager.cs.

◆ Dispose()

void Gondwana.Drawing.Sprites.SpriteManager.Dispose ( )

Releases all sprites currently managed by this instance.

Definition at line 424 of file SpriteManager.cs.

◆ GetSpriteByID()

Sprite? Gondwana.Drawing.Sprites.SpriteManager.GetSpriteByID ( string ID)

Retrieves a sprite by its ID/nickname.

Parameters
IDThe ID/nickname of the sprite to retrieve.
Returns
The sprite with the specified ID, or null if not found.

Definition at line 176 of file SpriteManager.cs.

◆ GetSpritesAtViewPixel()

List< Sprite > Gondwana.Drawing.Sprites.SpriteManager.GetSpritesAtViewPixel ( View view,
Point viewPxlPt,
SceneLayer? sceneLayer = null )

Gets all sprites at the specified view pixel coordinate.

Parameters
viewThe view to use for coordinate transformation.
viewPxlPtThe pixel coordinate in the view to check.
sceneLayerOptional scene layer to filter by. If null, searches all layers.
Returns
A list of sprites at the specified pixel location.

Definition at line 301 of file SpriteManager.cs.

◆ GetSpritesInViewRectRange()

List< Sprite > Gondwana.Drawing.Sprites.SpriteManager.GetSpritesInViewRectRange ( View view,
Rectangle viewRectPx,
SceneLayer? sceneLayer = null,
bool fullEnclosures = false )

Gets all sprites within the specified view rectangle range.

Parameters
viewThe view to use for coordinate transformation.
viewRectPxThe view rectangle in pixels to search within.
sceneLayerOptional scene layer to filter by. If null, searches all layers.
fullEnclosuresIf true, only returns sprites fully contained within the rectangle. If false, returns sprites that intersect with the rectangle.
Returns
A list of sprites within the specified view range.

Definition at line 260 of file SpriteManager.cs.

◆ GetSpritesInWorldRectRange()

List< Sprite > Gondwana.Drawing.Sprites.SpriteManager.GetSpritesInWorldRectRange ( Rectangle worldRect,
SceneLayer? sceneLayer = null,
bool fullEnclosures = false )

Gets all sprites within the specified world rectangle range.

Parameters
worldRectThe world rectangle to search within.
sceneLayerOptional scene layer to filter by. If null, searches all layers.
fullEnclosuresIf true, only returns sprites fully contained within the rectangle. If false, returns sprites that intersect with the rectangle.
Returns
A list of sprites within the specified range.

Definition at line 220 of file SpriteManager.cs.

◆ Remove() [1/2]

void Gondwana.Drawing.Sprites.SpriteManager.Remove ( Sprite sprite)

Removes and disposes the specified sprite.

Parameters
spriteThe sprite to remove.

Definition at line 142 of file SpriteManager.cs.

◆ Remove() [2/2]

void Gondwana.Drawing.Sprites.SpriteManager.Remove ( string ID)

Removes and disposes the sprite with the specified ID.

Parameters
IDThe ID/nickname of the sprite to remove.

Definition at line 151 of file SpriteManager.cs.

Property Documentation

◆ AllSprites

ReadOnlyCollection<Sprite> Gondwana.Drawing.Sprites.SpriteManager.AllSprites
get

Gets a read-only collection of all sprites currently managed by the sprite manager.

Definition at line 42 of file SpriteManager.cs.

◆ DefaultCollisionProfile

string Gondwana.Drawing.Sprites.SpriteManager.DefaultCollisionProfile
getset

Gets or sets the scene collision profile assigned to newly created sprites when no profile is specified explicitly.

Definition at line 62 of file SpriteManager.cs.

◆ Instance

SpriteManager Gondwana.Drawing.Sprites.SpriteManager.Instance
staticget

Gets the singleton instance of the sprite manager.

The shared SpriteManager instance.

Definition at line 25 of file SpriteManager.cs.

◆ SizeNewSpritesToSceneLayer

bool Gondwana.Drawing.Sprites.SpriteManager.SizeNewSpritesToSceneLayer = true
getset

Gets or sets a value indicating whether new sprites should be automatically sized to their scene layer.

Definition at line 54 of file SpriteManager.cs.

Event Documentation

◆ SpriteCreated

Action<Sprite>? Gondwana.Drawing.Sprites.SpriteManager.SpriteCreated

Event raised when a new sprite is created.

Definition at line 35 of file SpriteManager.cs.