![]() |
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 composite that owns other movable direct drawables and keeps their positions relative to a shared anchor. 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 composite anchor. | |
| void | SetPosition (Vector2 position) |
| Sets the composite anchor and repositions all children from their stored offsets. | |
| DirectComposite | SetPosition (float x, float y) |
| Sets the composite anchor and repositions all children from their stored offsets. | |
| virtual DirectComposite | Add (IDirectCompositeChild child, bool keepCurrentOffset=true, Vector2? explicitLocalOffsetPx=null) |
| Adds a composite-compatible direct drawable as a child. | |
| virtual DirectComposite | Remove (IDirectCompositeChild child) |
| Removes a child without disposing it. | |
| virtual DirectComposite | Clear () |
| Removes every child without disposing them. | |
| DirectComposite | SetLocalOffset (IDirectCompositeChild child, Vector2 newLocalOffsetPx) |
| Changes one child's local offset and reapplies its position. | |
| DirectComposite | SetZOrder (int zOrder) |
| Applies one Z-order to every descendant. | |
| DirectComposite | SetOpacity (float opacity) |
| Applies one opacity to every descendant. | |
| DirectComposite | SetIsVisible (bool visible) |
| Applies one visibility value to every descendant. | |
| DirectComposite | FadeTo (float targetOpacity, float durationSec) |
| Fades every descendant to the requested opacity. | |
| DirectComposite | FadeIn (float durationSec) |
| Fades every descendant to full opacity. | |
| DirectComposite | FadeOut (float durationSec) |
| Fades every descendant to zero opacity. | |
| RectangleF | GetDrawLocationScreen (View view) |
| Gets the union of all visible descendants as projected through a view. | |
| void | Draw (BackbufferBase backbuffer, RectangleF destRectScreen) |
| Performs no direct rendering because descendants render independently. | |
| virtual void | Update (long tick) |
| Advances composite movement. | |
| virtual void | Dispose () |
| Disposes the composite and every child it owns. | |
Protected Member Functions | |
| virtual void | OnChildAdded (IDirectCompositeChild child) |
| Called after a child has been successfully added. | |
| virtual void | OnChildRemoved (IDirectCompositeChild child) |
| Called after a child has been removed from the composite. | |
Properties | |
| Guid | Id = Guid.NewGuid() [get] |
| Gets the unique identifier of the composite. | |
| string? | Nickname [get] |
| Gets the optional diagnostic nickname of the composite. | |
| RenderSurfaceHostBase | RenderSurfaceHost [get] |
| Gets the render surface host shared by the composite and its children. | |
| DirectDrawingMode | Mode [get] |
| Gets the coordinate mode shared by the composite and its children. | |
| SceneLayer? | SceneLayer [get] |
| Gets the scene layer shared by all children in scene-layer mode. | |
| View? | View [get] |
| Gets the view shared by all children in view mode. | |
| ReadOnlyCollection< IDirectCompositeChild > | Children [get] |
| Gets the children owned by the composite. | |
| MovementController | Movement [get] |
| Gets the movement controller used to move the composite anchor. | |
| MovementSpace | PositionSpace [get] |
| Gets the coordinate space used by the movement controller. | |
| bool | Visible [get, set] |
| Gets or sets the visibility of all descendants. | |
| int | ZOrder [get] |
| Gets the composite Z-order. | |
| Rectangle | ScreenBounds [get] |
| Gets the union of all visible descendants' screen-space bounds. | |
| Rectangle | WorldBounds [get] |
| Gets the union of all visible descendants' world-space bounds. | |
Events | |
| EventHandler< IDirectDrawable >? | Disposing |
| Occurs when the composite is being disposed. | |
| Events inherited from Gondwana.Drawing.Direct.IDirectDrawable | |
| EventHandler< IDirectDrawable >? | Disposing |
| Occurs when the object is being disposed. | |
Represents a movable composite that owns other movable direct drawables and keeps their positions relative to a shared anchor.
A composite may recursively contain other composites. Every child must use the same render surface, drawing mode, and target View or SceneLayer.
A child may belong to only one composite at a time. Cyclic parent/child relationships are rejected.
Definition at line 28 of file DirectComposite.cs.
| 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 that owns the composite. |
| mode | The coordinate mode used by the composite and all of its children. |
| anchor | The composite anchor, in mode-appropriate pixels. |
| nickname | An optional diagnostic nickname. |
Definition at line 63 of file DirectComposite.cs.
|
virtual |
Adds a composite-compatible direct drawable as a child.
| child | The child to add. |
| keepCurrentOffset | true to preserve the child's current offset from the composite anchor. |
| explicitLocalOffsetPx | The offset to use when keepCurrentOffset is false. |
| ArgumentException | Thrown when the child uses another render surface, mode, view, or scene layer. |
| InvalidOperationException | Thrown when the child already has another parent or would create a cycle. |
Implements Gondwana.Drawing.Direct.IDirectCompositeContainer.
Reimplemented in Gondwana.Widgets.ContainerWidget, and Gondwana.Widgets.Layout.StackPanelWidget.
Definition at line 234 of file DirectComposite.cs.
|
virtual |
Removes every child without disposing them.
Implements Gondwana.Drawing.Direct.IDirectCompositeContainer.
Reimplemented in Gondwana.Widgets.ContainerWidget, and Gondwana.Widgets.Layout.StackPanelWidget.
Definition at line 302 of file DirectComposite.cs.
|
virtual |
Disposes the composite and every child it owns.
Reimplemented in Gondwana.Widgets.Controls.ComboBoxWidget, Gondwana.Widgets.Controls.RadioButtonWidget, Gondwana.Widgets.Controls.TabControlWidget, Gondwana.Widgets.Dialogs.AboutBox, Gondwana.Widgets.Dialogs.DialogBox, Gondwana.Widgets.Hud.HealthBarWidget, Gondwana.Widgets.Hud.NameTagWidget, Gondwana.Widgets.Hud.ProfilerWidget, Gondwana.Widgets.Menus.MenuBarWidget, Gondwana.Widgets.Menus.MenuDropDownWidget, Gondwana.Widgets.Menus.MenuItemWidget, Gondwana.Widgets.Overlays.PopupWidget, Gondwana.Widgets.Overlays.SplashScreen, and Gondwana.Widgets.Overlays.ToastWidget.
Definition at line 485 of file DirectComposite.cs.
| void Gondwana.Drawing.Direct.DirectComposite.Draw | ( | BackbufferBase | backbuffer, |
| RectangleF | destRectScreen ) |
Performs no direct rendering because descendants render independently.
| backbuffer | The backbuffer to draw to (not used). |
| destRectScreen | The destination rectangle in screen coordinates (not used). |
Implements Gondwana.Drawing.IDrawable.
Definition at line 461 of file DirectComposite.cs.
| DirectComposite Gondwana.Drawing.Direct.DirectComposite.FadeIn | ( | float | durationSec | ) |
Fades every descendant to full opacity.
| durationSec | The animation duration in seconds. |
| DirectComposite Gondwana.Drawing.Direct.DirectComposite.FadeOut | ( | float | durationSec | ) |
Fades every descendant to zero opacity.
| durationSec | The animation duration in seconds. |
| DirectComposite Gondwana.Drawing.Direct.DirectComposite.FadeTo | ( | float | targetOpacity, |
| float | durationSec ) |
Fades every descendant to the requested opacity.
| targetOpacity | The target opacity. |
| durationSec | The animation duration in seconds. |
Implements Gondwana.Drawing.Direct.IDirectCompositeChild.
Definition at line 389 of file DirectComposite.cs.
| RectangleF Gondwana.Drawing.Direct.DirectComposite.GetDrawLocationScreen | ( | View | view | ) |
Gets the union of all visible descendants as projected through a view.
| view | The view used for projection. |
Implements Gondwana.Drawing.IDrawable.
Definition at line 416 of file DirectComposite.cs.
| Vector2 Gondwana.Drawing.Direct.DirectComposite.GetPosition | ( | ) |
Gets the current composite anchor.
Implements Gondwana.Physics.Movement.IMovable.
|
protectedvirtual |
Called after a child has been successfully added.
| child | The child that was added. |
Overrides should perform only non-throwing bookkeeping. Derived types that need additional validation should override Add, perform that validation before calling the base implementation, and then allow this callback to perform the resulting bookkeeping.
Reimplemented in Gondwana.Widgets.ContainerWidget.
Definition at line 560 of file DirectComposite.cs.
|
protectedvirtual |
Called after a child has been removed from the composite.
| child | The child that was removed. |
Reimplemented in Gondwana.Widgets.ContainerWidget.
Definition at line 568 of file DirectComposite.cs.
|
virtual |
Removes a child without disposing it.
| child | The child to detach. |
Implements Gondwana.Drawing.Direct.IDirectCompositeContainer.
Reimplemented in Gondwana.Widgets.ContainerWidget, and Gondwana.Widgets.Layout.StackPanelWidget.
Definition at line 280 of file DirectComposite.cs.
| DirectComposite Gondwana.Drawing.Direct.DirectComposite.SetIsVisible | ( | bool | visible | ) |
Applies one visibility value to every descendant.
| visible | The visibility value to apply. |
Implements Gondwana.Drawing.Direct.IDirectCompositeChild.
Definition at line 377 of file DirectComposite.cs.
| DirectComposite Gondwana.Drawing.Direct.DirectComposite.SetLocalOffset | ( | IDirectCompositeChild | child, |
| Vector2 | newLocalOffsetPx ) |
Changes one child's local offset and reapplies its position.
| child | The child whose offset should change. |
| newLocalOffsetPx | The new offset from the composite anchor. |
Definition at line 330 of file DirectComposite.cs.
| DirectComposite Gondwana.Drawing.Direct.DirectComposite.SetOpacity | ( | float | opacity | ) |
Applies one opacity to every descendant.
| opacity | The opacity in the range 0 through 1. |
Implements Gondwana.Drawing.Direct.IDirectCompositeChild.
Definition at line 364 of file DirectComposite.cs.
| DirectComposite Gondwana.Drawing.Direct.DirectComposite.SetPosition | ( | float | x, |
| float | y ) |
Sets the composite anchor and repositions all children from their stored offsets.
| x | The new X coordinate. |
| y | The new Y coordinate. |
Definition at line 198 of file DirectComposite.cs.
| void Gondwana.Drawing.Direct.DirectComposite.SetPosition | ( | Vector2 | position | ) |
Sets the composite anchor and repositions all children from their stored offsets.
| position | The new anchor, in mode-appropriate pixels. |
Implements Gondwana.Physics.Movement.IMovable.
Definition at line 187 of file DirectComposite.cs.
| DirectComposite Gondwana.Drawing.Direct.DirectComposite.SetZOrder | ( | int | zOrder | ) |
Applies one Z-order to every descendant.
| zOrder | The Z-order to apply. |
Implements Gondwana.Drawing.Direct.IDirectCompositeChild.
Definition at line 351 of file DirectComposite.cs.
|
virtual |
Advances composite movement.
| tick | The current engine tick. |
This method uses the tick to calculate elapsed time and advance the movement controller. If the tick is less than or equal to the last processed tick, no update occurs.
Implements Gondwana.Drawing.Direct.IDirectDrawable.
Reimplemented in Gondwana.Widgets.Overlays.PopupWidget, and Gondwana.Widgets.Overlays.ToastWidget.
Definition at line 471 of file DirectComposite.cs.
|
get |
Gets the children owned by the composite.
Implements IDirectCompositeContainer.Children.
Implements Gondwana.Drawing.Direct.IDirectCompositeContainer.
Definition at line 129 of file DirectComposite.cs.
|
get |
Gets the unique identifier of the composite.
Implements Gondwana.Drawing.IDrawable.
Definition at line 88 of file DirectComposite.cs.
|
get |
Gets the coordinate mode shared by the composite and its children.
Implements Gondwana.Drawing.Direct.IDirectDrawable.
Definition at line 103 of file DirectComposite.cs.
|
get |
Gets the movement controller used to move the composite anchor.
Definition at line 134 of file DirectComposite.cs.
|
get |
Gets the optional diagnostic nickname of the composite.
Implements Gondwana.Drawing.IDrawable.
Definition at line 93 of file DirectComposite.cs.
|
get |
Gets the coordinate space used by the movement controller.
Implements Gondwana.Physics.Movement.IMovable.
Definition at line 139 of file DirectComposite.cs.
|
get |
Gets the render surface host shared by the composite and its children.
Implements Gondwana.Drawing.Direct.IDirectDrawable.
Definition at line 98 of file DirectComposite.cs.
|
get |
Gets the scene layer shared by all children in scene-layer mode.
The first child establishes this value. It is cleared when the composite becomes empty.
Implements Gondwana.Drawing.Direct.IDirectCompositeChild.
Definition at line 112 of file DirectComposite.cs.
|
get |
Gets the union of all visible descendants' screen-space bounds.
Implements Gondwana.Drawing.Direct.IDirectDrawable.
Definition at line 166 of file DirectComposite.cs.
|
get |
Gets the view shared by all children in view mode.
The first child establishes this value. It is cleared when the composite becomes empty.
Implements Gondwana.Drawing.Direct.IDirectCompositeChild.
Definition at line 121 of file DirectComposite.cs.
|
getset |
Gets or sets the visibility of all descendants.
Implements Gondwana.Drawing.IDrawable.
Definition at line 144 of file DirectComposite.cs.
|
get |
Gets the union of all visible descendants' world-space bounds.
Implements Gondwana.Drawing.Direct.IDirectDrawable.
Definition at line 171 of file DirectComposite.cs.
|
get |
Gets the composite Z-order.
A composite is not rendered directly; descendants retain their individual Z-orders. Use SetZOrder to update all descendants.
Implements Gondwana.Drawing.IDrawable.
Definition at line 161 of file DirectComposite.cs.
| EventHandler<IDirectDrawable>? Gondwana.Drawing.Direct.DirectComposite.Disposing |
Occurs when the composite is being disposed.
Definition at line 50 of file DirectComposite.cs.