![]() |
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.
|
Represents a composite sprite that contains multiple child sprites and manages them as a single unit. All child sprites must belong to the same SceneLayer. More...
Public Member Functions | |
| CompositeSprite () | |
| Initializes a new instance of the CompositeSprite class. | |
| CompositeSprite (List< Sprite > sprites) | |
| Initializes a new instance of the CompositeSprite class with the specified list of sprites. | |
| CompositeSprite (params Sprite[] sprites) | |
| Initializes a new instance of the CompositeSprite class with the specified array of sprites. | |
| Vector2 | GetPosition () |
| Gets the current position of the composite sprite in scene-layer grid coordinates, based on its anchor mode. | |
| void | SetPosition (Vector2 pos) |
| Sets the position of the composite sprite by moving all child sprites to maintain their relative positions. | |
| void | Translate (Vector2 delta) |
| Translates the composite sprite by the specified delta vector. | |
| void | Add (Sprite sprite) |
| Adds an existing sprite at its current position (no reposition). | |
| void | AddChildAtPosition (Sprite sprite, Vector2 absolutePosition) |
| Add a sprite and place it at an absolute position (in the composite's PositionSpace). | |
| void | AddChildWithOffset (Sprite sprite, Vector2 offsetFromCompositeAnchor) |
| Add a sprite and place it by offset from the composite anchor. Offset is interpreted in grid coordinates relative to the current composite anchor. | |
| void | Remove (Sprite sprite) |
| Removes a sprite from this composite. | |
Properties | |
| CompositeAnchorMode | AnchorMode = CompositeAnchorMode.TopLeft [get, set] |
| Gets or sets the anchor mode that determines how the composite's position is calculated relative to its children. | |
| MovementSpace | PositionSpace [get] |
| Gets the movement space used for positioning this composite sprite. | |
| SceneLayer | SceneLayer [get] |
| Gets the scene layer that all child sprites belong to. | |
| ReadOnlyCollection< Sprite > | Children [get] |
| Gets a read-only collection of all child sprites in this composite. | |
| Rectangle | Range [get] |
| Gets the bounding rectangle that encompasses all child sprites. Returns Rectangle.Empty if there are no children. | |
Represents a composite sprite that contains multiple child sprites and manages them as a single unit. All child sprites must belong to the same SceneLayer.
Definition at line 15 of file CompositeSprite.cs.
| Gondwana.Drawing.Sprites.CompositeSprite.CompositeSprite | ( | ) |
Initializes a new instance of the CompositeSprite class.
Definition at line 31 of file CompositeSprite.cs.
| Gondwana.Drawing.Sprites.CompositeSprite.CompositeSprite | ( | List< Sprite > | sprites | ) |
Initializes a new instance of the CompositeSprite class with the specified list of sprites.
| sprites | The list of sprites to add to this composite. |
Definition at line 37 of file CompositeSprite.cs.
| Gondwana.Drawing.Sprites.CompositeSprite.CompositeSprite | ( | params Sprite[] | sprites | ) |
Initializes a new instance of the CompositeSprite class with the specified array of sprites.
| sprites | The array of sprites to add to this composite. |
Definition at line 47 of file CompositeSprite.cs.
| void Gondwana.Drawing.Sprites.CompositeSprite.Add | ( | Sprite | sprite | ) |
Adds an existing sprite at its current position (no reposition).
| sprite | The sprite to add to this composite. |
| ArgumentNullException | Thrown when sprite is null. |
| InvalidOperationException | Thrown when the sprite belongs to a different SceneLayer than existing children. |
Definition at line 152 of file CompositeSprite.cs.
| void Gondwana.Drawing.Sprites.CompositeSprite.AddChildAtPosition | ( | Sprite | sprite, |
| Vector2 | absolutePosition ) |
Add a sprite and place it at an absolute position (in the composite's PositionSpace).
| sprite | The sprite to add to this composite. |
| absolutePosition | The absolute position to place the sprite at. |
| ArgumentNullException | Thrown when sprite is null. |
| InvalidOperationException | Thrown when the sprite belongs to a different SceneLayer than existing children. |
Definition at line 170 of file CompositeSprite.cs.
| void Gondwana.Drawing.Sprites.CompositeSprite.AddChildWithOffset | ( | Sprite | sprite, |
| Vector2 | offsetFromCompositeAnchor ) |
Add a sprite and place it by offset from the composite anchor. Offset is interpreted in grid coordinates relative to the current composite anchor.
| sprite | The sprite to add to this composite. |
| offsetFromCompositeAnchor | The offset from the composite's anchor point. |
| ArgumentNullException | Thrown when sprite is null. |
| InvalidOperationException | Thrown when the sprite belongs to a different SceneLayer than existing children. |
Definition at line 191 of file CompositeSprite.cs.
| Vector2 Gondwana.Drawing.Sprites.CompositeSprite.GetPosition | ( | ) |
Gets the current position of the composite sprite in scene-layer grid coordinates, based on its anchor mode.
Implements Gondwana.Physics.Movement.IMovable.
Definition at line 90 of file CompositeSprite.cs.
| void Gondwana.Drawing.Sprites.CompositeSprite.Remove | ( | Sprite | sprite | ) |
Removes a sprite from this composite.
| sprite | The sprite to remove. |
Definition at line 224 of file CompositeSprite.cs.
| void Gondwana.Drawing.Sprites.CompositeSprite.SetPosition | ( | Vector2 | pos | ) |
Sets the position of the composite sprite by moving all child sprites to maintain their relative positions.
| pos | The new position for the composite's anchor point. |
Implements Gondwana.Physics.Movement.IMovable.
Definition at line 113 of file CompositeSprite.cs.
| void Gondwana.Drawing.Sprites.CompositeSprite.Translate | ( | Vector2 | delta | ) |
Translates the composite sprite by the specified delta vector.
| delta | The translation vector to apply. |
Definition at line 134 of file CompositeSprite.cs.
|
getset |
Gets or sets the anchor mode that determines how the composite's position is calculated relative to its children.
Definition at line 24 of file CompositeSprite.cs.
|
get |
Gets a read-only collection of all child sprites in this composite.
Definition at line 264 of file CompositeSprite.cs.
|
get |
Gets the movement space used for positioning this composite sprite.
Implements Gondwana.Physics.Movement.IMovable.
Definition at line 66 of file CompositeSprite.cs.
|
get |
Gets the bounding rectangle that encompasses all child sprites. Returns Rectangle.Empty if there are no children.
Definition at line 271 of file CompositeSprite.cs.
|
get |
Gets the scene layer that all child sprites belong to.
| InvalidOperationException | Thrown when the composite has no children. |
Implements Gondwana.Physics.Movement.IMovableOnSceneLayer.
Definition at line 73 of file CompositeSprite.cs.