![]() |
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 movable visual element on a scene layer. More...
Public Member Functions | |||||
| Vector2 | GetPosition () | ||||
| Gets the sprite position in scene-layer grid coordinates. | |||||
| void | SetPosition (Vector2 pos) | ||||
| Sets the sprite position in scene-layer grid coordinates and invalidates its old and new bounds. | |||||
| RectangleF | GetVisualBoundsScreen (View view) | ||||
| Gets the axis-aligned screen-pixel bounds enclosing the rotated sprite. | |||||
| override void | Draw (BackbufferBase backbuffer, RectangleF destRectScreen) | ||||
Draws the current content into the backbuffer at the supplied screen-pixel bounds.
| |||||
| void | TranslateWorldPx (int dx, int dy) | ||||
| Applies a world-pixel translation without rebuilding the absolute position from an integer rectangle, preserving fractional coordinates on the other axis. | |||||
| void | CancelVelocityComponent (bool cancelX, bool cancelY) | ||||
| Clears the requested horizontal and vertical velocity components. | |||||
| override void | Dispose () | ||||
| Releases the resources owned by this instance. | |||||
| void | StartJiggle (float intensityX=2f, float intensityY=2f, float speed=8f, float durationSeconds=0.25f, bool loop=false, bool affectsScale=false, float scaleIntensity=0.02f, bool decay=true) | ||||
| Starts a smooth, randomized-looking jiggle animation. This jiggle is visual only and does not modify RenderSize or collision bounds. | |||||
| void | StopJiggle () | ||||
| Stops the current jiggle effect. | |||||
| void | JiggleOnce (float intensityX=2f, float intensityY=2f, float speed=12f, float durationSeconds=0.18f, bool affectsScale=false, float scaleIntensity=0.015f) | ||||
| Starts a one-shot impact-style jiggle. Handy for hits, invalid selections, bump feedback, and similar moments. | |||||
| void | ResizeTo (Size targetSize, float durationSeconds) | ||||
| Smoothly resizes the sprite to an absolute pixel size. | |||||
| void | ScaleBy (float factor, float durationSeconds) | ||||
| Scales the sprite by a factor relative to its current render size. | |||||
| void | PulseTo (Size targetSize, float growDurationSeconds, float shrinkDurationSeconds, bool loop=false) | ||||
| Resizes to an absolute target size and then returns to the original size. | |||||
| void | PulseBy (float factor, float growDurationSeconds, float shrinkDurationSeconds, bool loop=false) | ||||
| Pulses by a factor relative to the current render size. | |||||
| void | StopPulse (bool snapBack=true, float returnDuration=0f) | ||||
| Stops the current pulse, optionally returning to the original size. | |||||
| void | CancelResize () | ||||
| Cancels any in-progress resize or pulse. | |||||
| Public Member Functions inherited from Gondwana.Drawing.Tile | |||||
| virtual RectangleF | GetDrawLocationScreen (View view) | ||||
| Transforms the drawable bounds into screen pixels for the specified view. | |||||
| virtual RectangleF | GetCollisionAreaScreen (View view) | ||||
| Transforms the collision bounds into screen pixels for the specified view. | |||||
| void | SetCollisionProfile (string profileName) | ||||
| Applies a named profile from this tile's parent scene. If the layer has not yet been attached to a scene, the name is retained and resolved later when the collider is attached or the profile is reapplied. | |||||
| int | CompareTo (Tile? tile) | ||||
| Compares this tile with another tile using their render ordering. | |||||
Properties | |
| MovementSpace | PositionSpace [get] |
| Gets the coordinate space used by the position API. | |
| float | Rotation [get, set] |
| Gets or sets the clockwise visual rotation, in degrees, around the center of the sprite's render rectangle. | |
| Rectangle | VisualBoundsWorld [get] |
| Gets the axis-aligned world-pixel bounds enclosing the rotated sprite. | |
| MovementController | Movement = null! [get] |
| Gets the controller that manages sprite movement. | |
| override Frame | CurrentFrame [get, set] |
| override bool | Visible [get, set] |
| Gets a value indicating whether the object is visible. | |
| HorizontalAlignment | HorizAlign [get, set] |
| Gets or sets the horiz align. | |
| VerticalAlignment | VertAlign [get, set] |
| Gets or sets the vert align. | |
| int | NudgeX [get, set] |
| Gets or sets the nudge x. | |
| int | NudgeY [get, set] |
| Gets or sets the nudge y. | |
| Size | RenderSize [get, set] |
| Gets or sets the render size. | |
| override Rectangle | DrawLocationWorld [get] |
| override bool | IsPositionFixed [get] |
| override PointF | SceneLayerCoordinates [get] |
| override SceneLayer | SceneLayer [get] |
| override int | ZOrder [get, set] |
| Gets the z-order of the element, which determines its visual stacking order relative to other elements. Higher z-order values are drawn on top of lower ones. | |
| bool | IsJiggling [get] |
| Gets whether the sprite is currently jiggling. | |
| PointF | JiggleOffset [get] |
| Gets the current visual jiggle offset in screen/world pixels, depending on how the sprite is being drawn. | |
| float | JiggleScale [get] |
| Gets the current visual jiggle scale multiplier. This is intended to be applied at draw time only. | |
| Properties inherited from Gondwana.Drawing.Tile | |
| static List< Tile > | TilesAnimating = new() [get] |
| Gets the collection of all tiles that are currently animating in the scene. | |
| bool | IsPositionFixed [get] |
| Gets whether the tile occupies a fixed position in its layer. | |
| Rectangle | DrawLocationWorld [get] |
| Gets the tile drawing bounds in world pixels. | |
| PointF | SceneLayerCoordinates [get] |
| Gets the position in scene-layer grid coordinates. | |
| SceneLayer | SceneLayer [get] |
| Gets the scene layer that owns this tile. | |
| Guid | Id = Guid.NewGuid() [get, set] |
| Gets the unique identifier. | |
| string? | Nickname [get, set] |
| Gets or sets the optional lookup name. | |
| virtual bool | Visible [get, set] |
| Gets or sets whether this drawable is visible. | |
| virtual int | ZOrder [get, set] |
| Gets or sets the drawing order within the layer. | |
| virtual Spacing | Overhang [get] |
| Gets the current frame's visual overhang beyond its tile bounds. | |
| virtual Frame | CurrentFrame [get, set] |
| Gets or sets the current frame. The initial frame supplies the tile's default collision adjustment and collision type. Later frame changes update those values only when their corresponding by-frame options are enabled. | |
| virtual Animator | TileAnimator [get] |
| Gets the animator associated with this tile. | |
| virtual bool | PauseAnimation [get, set] |
| Gets or sets whether animation is paused. | |
| virtual ? ICollider | Collider [get] |
| Gets the collision shape associated with this tile. | |
| virtual Rectangle | CollisionArea [get] |
| Gets the effective collision area in world coordinates. | |
| virtual bool | EnableFog [get, set] |
| Gets or sets whether scene-layer fog applies to this tile. | |
| virtual Point[] | OutlinePointsWorld [get] |
| Gets the tile outline vertices in world pixels. | |
| virtual bool | AdjustCollisionAreaByFrame [get, set] |
| Gets or sets whether frame changes replace the tile's collision adjustment with the newly selected frame's adjustment. | |
| virtual CollisionAdjust | AdjustCollisionArea [get, set] |
| Gets or sets the collision adjustment used to derive CollisionArea. | |
| virtual TileCollisionType | CollisionType [get, set] |
| Gets or sets the tile's collision behavior. This is initialized from the first assigned frame and may subsequently be overridden per tile. | |
| virtual bool | CollisionTypeByFrame [get, set] |
| Gets or sets whether frame changes replace this tile's collision type with the newly selected frame's effective collision type. | |
| string? | CollisionProfileName [get] |
| Gets the scene-level collision profile currently associated with this tile. | |
| bool | CollisionsEnabled [get, set] |
| Gets or sets whether this tile participates in collision detection. | |
| TypedValueBag | ValueBag = new() [get] |
| Gets the custom typed values associated with this object. | |
Events | |
| Action< SpriteMovedEventArgs >? | SpriteMoved |
| Occurs when the sprite position changes. | |
| Action< Sprite >? | VisualBoundsChanged |
| Occurs when the sprite visual bounds change. | |
| Action< Sprite >? | Disposing |
| Occurs when disposal begins. | |
| Action? | ResizeComplete |
| Raised when a resize or pulse animation completes its current leg, or when cancelled. | |
Additional Inherited Members | |
| Protected Member Functions inherited from Gondwana.Drawing.Tile | |
| void | CopyCollisionSettingsFrom (Tile source) |
| Copies collision behavior, profile, and effective frame metadata from another tile. | |
| void | DetachCollider () |
| Detaches the current collider from its scene-layer registry without otherwise changing this tile's serialized collision state. | |
| void | AttachCollider (ICollider collider) |
| Attaches this tile's collider and applies any collision state that was set before the collider became available. | |
| Protected Attributes inherited from Gondwana.Drawing.Tile | |
| bool | pauseAnimation |
| The pause animation. | |
| ICollider? | _collider |
| The collider. | |
Represents a movable visual element on a scene layer.
Partial class containing resize and pulse animation members for Sprite.
Partial class containing jiggle animation members for Sprite.
| void Gondwana.Drawing.Sprites.Sprite.CancelResize | ( | ) |
Cancels any in-progress resize or pulse.
Definition at line 291 of file Sprite.Resize.cs.
| void Gondwana.Drawing.Sprites.Sprite.CancelVelocityComponent | ( | bool | cancelX, |
| bool | cancelY ) |
Clears the requested horizontal and vertical velocity components.
| cancelX | Whether to clear the horizontal velocity component. |
| cancelY | Whether to clear the vertical velocity component. |
Implements Gondwana.Physics.Collisions.ICollisionMovableEntity.
|
virtual |
Releases the resources owned by this instance.
Reimplemented from Gondwana.Drawing.Tile.
|
virtual |
Draws the current content into the backbuffer at the supplied screen-pixel bounds.
| backbuffer | The backbuffer receiving the drawing commands. |
| destRectScreen | The destination rectangle in screen pixels. |
Reimplemented from Gondwana.Drawing.Tile.
| Vector2 Gondwana.Drawing.Sprites.Sprite.GetPosition | ( | ) |
Gets the sprite position in scene-layer grid coordinates.
| RectangleF Gondwana.Drawing.Sprites.Sprite.GetVisualBoundsScreen | ( | View | view | ) |
Gets the axis-aligned screen-pixel bounds enclosing the rotated sprite.
| view | The view used for presentation and coordinate conversion. |
| void Gondwana.Drawing.Sprites.Sprite.JiggleOnce | ( | float | intensityX = 2f, |
| float | intensityY = 2f, | ||
| float | speed = 12f, | ||
| float | durationSeconds = 0::18f, | ||
| bool | affectsScale = false, | ||
| float | scaleIntensity = 0::015f ) |
Starts a one-shot impact-style jiggle. Handy for hits, invalid selections, bump feedback, and similar moments.
| intensityX | The intensity x. |
| intensityY | The intensity y. |
| speed | The speed. |
| durationSeconds | The duration in seconds. |
| affectsScale | Whether the effect also changes the drawing scale. |
| scaleIntensity | The scale intensity. |
Definition at line 270 of file Sprite.Jiggle.cs.
| void Gondwana.Drawing.Sprites.Sprite.PulseBy | ( | float | factor, |
| float | growDurationSeconds, | ||
| float | shrinkDurationSeconds, | ||
| bool | loop = false ) |
Pulses by a factor relative to the current render size.
| factor | The factor. |
| growDurationSeconds | The grow duration seconds. |
| shrinkDurationSeconds | The shrink duration seconds. |
| loop | Whether playback repeats at the end. |
Definition at line 244 of file Sprite.Resize.cs.
| void Gondwana.Drawing.Sprites.Sprite.PulseTo | ( | Size | targetSize, |
| float | growDurationSeconds, | ||
| float | shrinkDurationSeconds, | ||
| bool | loop = false ) |
Resizes to an absolute target size and then returns to the original size.
| targetSize | The target size. |
| growDurationSeconds | The grow duration seconds. |
| shrinkDurationSeconds | The shrink duration seconds. |
| loop | Whether playback repeats at the end. |
Definition at line 210 of file Sprite.Resize.cs.
| void Gondwana.Drawing.Sprites.Sprite.ResizeTo | ( | Size | targetSize, |
| float | durationSeconds ) |
Smoothly resizes the sprite to an absolute pixel size.
| targetSize | The target size. |
| durationSeconds | The duration in seconds. |
Definition at line 168 of file Sprite.Resize.cs.
| void Gondwana.Drawing.Sprites.Sprite.ScaleBy | ( | float | factor, |
| float | durationSeconds ) |
Scales the sprite by a factor relative to its current render size.
| factor | The factor. |
| durationSeconds | The duration in seconds. |
Definition at line 191 of file Sprite.Resize.cs.
| void Gondwana.Drawing.Sprites.Sprite.SetPosition | ( | Vector2 | pos | ) |
| void Gondwana.Drawing.Sprites.Sprite.StartJiggle | ( | float | intensityX = 2f, |
| float | intensityY = 2f, | ||
| float | speed = 8f, | ||
| float | durationSeconds = 0::25f, | ||
| bool | loop = false, | ||
| bool | affectsScale = false, | ||
| float | scaleIntensity = 0::02f, | ||
| bool | decay = true ) |
Starts a smooth, randomized-looking jiggle animation. This jiggle is visual only and does not modify RenderSize or collision bounds.
| intensityX | Maximum horizontal jiggle in pixels. |
| intensityY | Maximum vertical jiggle in pixels. |
| speed | How quickly the jiggle animates. |
| durationSeconds | Duration of the jiggle. Ignored if loop is true. |
| loop | Whether the jiggle should continue indefinitely. |
| affectsScale | Whether to add a subtle visual size wobble during the jiggle. |
| scaleIntensity | Maximum scale wobble amount. Example: 0.03 = about ±3%. |
| decay | Whether the jiggle should gradually fade out over its duration. |
Definition at line 84 of file Sprite.Jiggle.cs.
| void Gondwana.Drawing.Sprites.Sprite.StopJiggle | ( | ) |
Stops the current jiggle effect.
Definition at line 125 of file Sprite.Jiggle.cs.
| void Gondwana.Drawing.Sprites.Sprite.StopPulse | ( | bool | snapBack = true, |
| float | returnDuration = 0f ) |
Stops the current pulse, optionally returning to the original size.
| snapBack | Whether to restore the original position when the effect ends. |
| returnDuration | The return duration. |
Definition at line 267 of file Sprite.Resize.cs.
| void Gondwana.Drawing.Sprites.Sprite.TranslateWorldPx | ( | int | dx, |
| int | dy ) |
Applies a world-pixel translation without rebuilding the absolute position from an integer rectangle, preserving fractional coordinates on the other axis.
| dx | The horizontal displacement in world pixels. |
| dy | The vertical displacement in world pixels. |
Implements Gondwana.Physics.Collisions.ICollisionMovableEntity.
|
getset |
|
get |
|
getset |
|
get |
Gets whether the sprite is currently jiggling.
Definition at line 49 of file Sprite.Jiggle.cs.
|
get |
|
get |
Gets the current visual jiggle offset in screen/world pixels, depending on how the sprite is being drawn.
Definition at line 55 of file Sprite.Jiggle.cs.
|
get |
Gets the current visual jiggle scale multiplier. This is intended to be applied at draw time only.
Definition at line 61 of file Sprite.Jiggle.cs.
|
get |
|
getset |
|
getset |
|
get |
|
getset |
|
getset |
Gets or sets the clockwise visual rotation, in degrees, around the center of the sprite's render rectangle.
Rotation affects rendering and dirty-region bounds. Collision geometry remains axis-aligned and continues to use Tile.CollisionArea.
|
get |
|
get |
|
getset |
|
getset |
Gets a value indicating whether the object is visible.
Implements Gondwana.Drawing.IDrawable.
|
get |
|
getset |
Gets the z-order of the element, which determines its visual stacking order relative to other elements. Higher z-order values are drawn on top of lower ones.
Implements Gondwana.Drawing.IDrawable.
| Action<Sprite>? Gondwana.Drawing.Sprites.Sprite.Disposing |
| Action? Gondwana.Drawing.Sprites.Sprite.ResizeComplete |
Raised when a resize or pulse animation completes its current leg, or when cancelled.
Definition at line 14 of file Sprite.Resize.cs.
| Action<SpriteMovedEventArgs>? Gondwana.Drawing.Sprites.Sprite.SpriteMoved |