![]() |
Gondwana Game Engine
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, mobile, and web platforms using SkiaSharp for graphics and NAudio for sound.
|
Represents a composite container that groups multiple direct drawable items together, managing their positions relative to a common anchor point and providing batch operations. More...
Public Member Functions | |
| DirectComposite (RenderSurfaceHostBase renderSurfaceHost, DirectDrawingMode mode, PointF anchor=default, string? nickname=null) | |
| Initializes a new instance of the DirectComposite class. | |
| Vector2 | GetPosition () |
| Gets the current anchor position of the composite in pixels. | |
| void | SetPosition (Vector2 pos) |
| Sets the composite anchor position using a Vector2. | |
| RectangleF | GetDrawLocationScreen (View view) |
| Gets the screen rectangle that encompasses all visible children in the composite. | |
| void | Draw (BackbufferBase backbuffer, RectangleF destRectScreen) |
| Draws the composite. This is intentionally a no-op as children are responsible for their own rendering. | |
| DirectComposite | Add (DirectDrawingMovableBase child, bool keepCurrentOffset=true, Vector2? explicitLocalOffsetPx=null) |
| Adds a child and stores its local pixel offset from the composite anchor. If keepCurrentOffset is true (default), the offset is computed from the child's current Bounds. Otherwise, pass an explicit local pixel offset. | |
| DirectComposite | Remove (DirectDrawingMovableBase child) |
| Removes a child from the composite. | |
| DirectComposite | Clear () |
| Removes all children from the composite. | |
| DirectComposite | SetPosition (float x, float y) |
| Sets the composite anchor position in pixels and repositions all children from their stored local offsets. | |
| DirectComposite | SetLocalOffset (DirectDrawingMovableBase child, Vector2 newLocalOffsetPx) |
| Changes a specific child's local pixel offset and re-applies its absolute position. | |
| DirectComposite | SetZOrder (int z) |
| Sets the Z-order for all children in the composite. | |
| DirectComposite | SetOpacity (float opacity) |
| Sets the opacity for all children in the composite. | |
| DirectComposite | SetIsVisible (bool visible) |
| Sets the visibility for all children in the composite. | |
| DirectComposite | FadeTo (float targetOpacity, float durationSec) |
| Fades all children to the specified target opacity over the given duration. | |
| DirectComposite | FadeIn (float durationSec) |
| Fades all children to full opacity (1.0) over the given duration. | |
| DirectComposite | FadeOut (float durationSec) |
| Fades all children to zero opacity (0.0) over the given duration. | |
| void | Update (long tick) |
| Updates the composite's movement controller based on the current tick. | |
| void | Dispose () |
| Releases all resources used by the composite and disposes all child drawables. | |
Properties | |
| RenderSurfaceHostBase | RenderSurfaceHost [get] |
| Gets the render surface host associated with this composite. | |
| DirectDrawingMode | Mode [get] |
| Gets the drawing mode for this composite (world or screen space). | |
| ReadOnlyCollection< DirectDrawingMovableBase > | Children [get] |
| Gets the read-only collection of child drawable items in this composite. | |
| MovementController | Movement [get] |
| Gets the movement controller for animating the composite's position. | |
| Rectangle | ScreenBounds [get] |
| Gets the bounding rectangle that encompasses all visible children in screen coordinates. | |
| Rectangle | WorldBounds [get] |
| Gets the bounding rectangle that encompasses all visible children in world coordinates. | |
| MovementSpace | PositionSpace [get] |
| Gets the position space used by this composite. Always returns MovementSpace.Pixel. | |
| Guid | Id = Guid.NewGuid() [get] |
| Gets the unique identifier for this composite. | |
| string? | Nickname [get] |
| Gets the optional friendly name for this composite. | |
| bool | Visible [get, set] |
| Gets or sets the visibility of the composite. Returns true if any child is visible; setting this sets all children's Visible to the same value. | |
| int | ZOrder [get] |
| Gets the Z-order of the composite. Always returns 0 as individual children manage their own Z-order. | |
Events | |
| EventHandler< IDirectDrawable >? | Disposing |
| Event raised when this composite is being disposed. | |
| Events inherited from Gondwana.Drawing.Direct.IDirectDrawable | |
| EventHandler< IDirectDrawable >? | Disposing |
| Occurs when the object is being disposed. | |
Represents a composite container that groups multiple direct drawable items together, managing their positions relative to a common anchor point and providing batch operations.
| Gondwana.Drawing.Direct.DirectComposite.DirectComposite | ( | RenderSurfaceHostBase | renderSurfaceHost, |
| DirectDrawingMode | mode, | ||
| PointF | anchor = default, | ||
| string? | nickname = null ) |
Initializes a new instance of the DirectComposite class.
| renderSurfaceHost | The render surface host for drawing operations. |
| mode | The drawing mode (world or screen space). |
| anchor | The anchor point for the composite in pixels. Default is (0, 0). |
| nickname | Optional friendly name for the composite. |
| DirectComposite Gondwana.Drawing.Direct.DirectComposite.Add | ( | DirectDrawingMovableBase | child, |
| bool | keepCurrentOffset = true, | ||
| Vector2? | explicitLocalOffsetPx = null ) |
Adds a child and stores its local pixel offset from the composite anchor. If keepCurrentOffset is true (default), the offset is computed from the child's current Bounds. Otherwise, pass an explicit local pixel offset.
| child | The child drawable to add to the composite. |
| keepCurrentOffset | If true, computes the offset from the child's current position relative to the anchor. If false, uses the explicit offset. |
| explicitLocalOffsetPx | Optional explicit pixel offset to use when keepCurrentOffset is false. |
| DirectComposite Gondwana.Drawing.Direct.DirectComposite.Clear | ( | ) |
Removes all children from the composite.
| void Gondwana.Drawing.Direct.DirectComposite.Dispose | ( | ) |
Releases all resources used by the composite and disposes all child drawables.
| void Gondwana.Drawing.Direct.DirectComposite.Draw | ( | BackbufferBase | backbuffer, |
| RectangleF | destRectScreen ) |
Draws the composite. This is intentionally a no-op as children are responsible for their own rendering.
| backbuffer | The backbuffer to draw to. |
| destRectScreen | The destination rectangle in screen coordinates. |
Implements Gondwana.Drawing.IDrawable.
| DirectComposite Gondwana.Drawing.Direct.DirectComposite.FadeIn | ( | float | durationSec | ) |
Fades all children to full opacity (1.0) over the given duration.
| durationSec | The duration of the fade-in animation in seconds. |
| DirectComposite Gondwana.Drawing.Direct.DirectComposite.FadeOut | ( | float | durationSec | ) |
Fades all children to zero opacity (0.0) over the given duration.
| durationSec | The duration of the fade-out animation in seconds. |
| DirectComposite Gondwana.Drawing.Direct.DirectComposite.FadeTo | ( | float | targetOpacity, |
| float | durationSec ) |
Fades all children to the specified target opacity over the given duration.
| targetOpacity | The target opacity value (0.0 to 1.0). |
| durationSec | The duration of the fade animation in seconds. |
| RectangleF Gondwana.Drawing.Direct.DirectComposite.GetDrawLocationScreen | ( | View | view | ) |
Gets the screen rectangle that encompasses all visible children in the composite.
| view | The view to use for coordinate transformation. |
Implements Gondwana.Drawing.IDrawable.
| Vector2 Gondwana.Drawing.Direct.DirectComposite.GetPosition | ( | ) |
Gets the current anchor position of the composite in pixels.
Implements Gondwana.Movement.IMovable.
| DirectComposite Gondwana.Drawing.Direct.DirectComposite.Remove | ( | DirectDrawingMovableBase | child | ) |
Removes a child from the composite.
| child | The child drawable to remove. |
| DirectComposite Gondwana.Drawing.Direct.DirectComposite.SetIsVisible | ( | bool | visible | ) |
Sets the visibility for all children in the composite.
| visible | True to make all children visible; false to hide them. |
| DirectComposite Gondwana.Drawing.Direct.DirectComposite.SetLocalOffset | ( | DirectDrawingMovableBase | child, |
| Vector2 | newLocalOffsetPx ) |
Changes a specific child's local pixel offset and re-applies its absolute position.
| child | The child whose offset to change. |
| newLocalOffsetPx | The new local pixel offset relative to the composite's anchor. |
| DirectComposite Gondwana.Drawing.Direct.DirectComposite.SetOpacity | ( | float | opacity | ) |
Sets the opacity for all children in the composite.
| opacity | The opacity value (0.0 to 1.0) to apply to all children. |
| DirectComposite Gondwana.Drawing.Direct.DirectComposite.SetPosition | ( | float | x, |
| float | y ) |
Sets the composite anchor position in pixels and repositions all children from their stored local offsets.
| x | The X coordinate of the anchor in pixels. |
| y | The Y coordinate of the anchor in pixels. |
| void Gondwana.Drawing.Direct.DirectComposite.SetPosition | ( | Vector2 | pos | ) |
Sets the composite anchor position using a Vector2.
| pos | The new anchor position in pixels. |
Implements Gondwana.Movement.IMovable.
| DirectComposite Gondwana.Drawing.Direct.DirectComposite.SetZOrder | ( | int | z | ) |
Sets the Z-order for all children in the composite.
| z | The Z-order value to apply to all children. |
| void Gondwana.Drawing.Direct.DirectComposite.Update | ( | long | tick | ) |
Updates the composite's movement controller based on the current tick.
| tick | The current high-resolution tick value. |
Implements Gondwana.Drawing.Direct.IDirectDrawable.
|
get |
Gets the read-only collection of child drawable items in this composite.
|
get |
Gets the unique identifier for this composite.
Implements Gondwana.Drawing.IDrawable.
|
get |
Gets the drawing mode for this composite (world or screen space).
Implements Gondwana.Drawing.Direct.IDirectDrawable.
|
get |
Gets the movement controller for animating the composite's position.
|
get |
Gets the optional friendly name for this composite.
Implements Gondwana.Drawing.IDrawable.
|
get |
Gets the position space used by this composite. Always returns MovementSpace.Pixel.
Implements Gondwana.Movement.IMovable.
|
get |
Gets the render surface host associated with this composite.
Implements Gondwana.Drawing.Direct.IDirectDrawable.
|
get |
Gets the bounding rectangle that encompasses all visible children in screen coordinates.
Implements Gondwana.Drawing.Direct.IDirectDrawable.
|
getset |
Gets or sets the visibility of the composite. Returns true if any child is visible; setting this sets all children's Visible to the same value.
Implements Gondwana.Drawing.IDrawable.
|
get |
Gets the bounding rectangle that encompasses all visible children in world coordinates.
Implements Gondwana.Drawing.Direct.IDirectDrawable.
|
get |
Gets the Z-order of the composite. Always returns 0 as individual children manage their own Z-order.
Implements Gondwana.Drawing.IDrawable.
| EventHandler<IDirectDrawable>? Gondwana.Drawing.Direct.DirectComposite.Disposing |
Event raised when this composite is being disposed.