![]() |
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.
|
Hosts a render surface and manages rendering of a scene to a backbuffer of the specified type. Provides coordination between the scene, views, and the underlying UI adapter for efficient rendering and presentation. More...
Public Member Functions | |
| RenderSurfaceHost() | RenderSurfaceHost (RenderSurfaceAdapterBase renderSurfaceAdapter) |
| Initializes a new instance of the RenderSurfaceHost<TBackbuffer> class with the specified render surface adapter. | |
| void | Bind (Scene newScene, bool limitCameraToWorldBoundPx=true) |
| Binds a scene to this render surface host, replacing any previously bound scene. | |
| void | Dispose () |
| Releases all resources used by this RenderSurfaceHost<TBackbuffer> instance. | |
| void | Dispose (bool disposing) |
| Releases resources used by this RenderSurfaceHost<TBackbuffer> instance. | |
| Public Member Functions inherited from Gondwana.Rendering.RenderSurfaceHostBase | |
| void | Dispose () |
| Releases all resources used by this RenderSurfaceHostBase instance. | |
Properties | |
| override BackbufferBase | Backbuffer [get] |
| Gets the backbuffer used for off-screen rendering before presentation to the adapter. | |
| override Scene | Scene [get] |
| Gets the scene currently bound to this render surface host. | |
| override RenderSurfaceAdapterBase | RenderSurfaceAdapter [get] |
| Gets the platform-specific adapter that provides the underlying rendering surface. | |
| override ViewManager | ViewManager [get] |
| Gets the view manager that controls camera positions, viewports, and multi-view rendering. | |
| bool | RedrawDirtyRectangleOnly = true [get, set] |
| Gets or sets a value indicating whether only the dirty (changed) regions of the backbuffer are presented to the adapter each frame. | |
| Properties inherited from Gondwana.Rendering.RenderSurfaceHostBase | |
| BackbufferBase | Backbuffer [get] |
| Gets the in-memory BackbufferBase associated with the current rendering context. | |
| Scene | Scene [get] |
| Gets the source Scenes.Scene used for rendering operations. | |
| RenderSurfaceAdapterBase? | RenderSurfaceAdapter [get] |
| Gets the platform-specific RenderSurfaceAdapterBase responsible for rendering the image from the Backbuffer. | |
| ViewManager | ViewManager [get] |
| Gets the view manager that controls camera positions, viewports, and multi-view rendering for this render surface host. | |
Events | |
| EventHandler< RenderSurfaceHostBindEventArgs >? | BindToScene |
| Occurs when a scene is bound to or unbound from this render surface host. | |
| Action | RenderBackbufferBegin |
| Occurs at the beginning of the backbuffer rendering process. | |
| Action | RenderBackbufferEnd |
| Occurs at the end of the backbuffer rendering process. | |
| Action | RenderBackbufferNoOp |
| Occurs when a backbuffer render operation is skipped because the scene is not dirty. | |
Additional Inherited Members | |
| Protected Member Functions inherited from Gondwana.Rendering.RenderSurfaceHostBase | |
| RenderSurfaceHostBase () | |
| Initializes a new instance of the RenderSurfaceHostBase class and registers it with the RenderSurfaceHostRegistry. | |
Hosts a render surface and manages rendering of a scene to a backbuffer of the specified type. Provides coordination between the scene, views, and the underlying UI adapter for efficient rendering and presentation.
RenderSurfaceHost<TBackbuffer> is responsible for managing the lifecycle of the backbuffer, handling scene binding, and coordinating redraws based on scene and view changes. It supports partial or full redraws depending on the state of the scene and the RedrawDirtyRectangleOnly property. Thread safety is not guaranteed; all interactions should occur on the UI thread associated with the render surface adapter.
| TBackbuffer | The type of backbuffer used for rendering. Must inherit from BackbufferBase. |
| TBackbuffer | : | BackbufferBase |
| void Gondwana.Rendering.RenderSurfaceHost< TBackbuffer >.Bind | ( | Scene | newScene, |
| bool | limitCameraToWorldBoundPx = true ) |
Binds a scene to this render surface host, replacing any previously bound scene.
| newScene | The scene to bind. Must not be null. |
| limitCameraToWorldBoundPx | true to constrain all view cameras to the scene's world bounds; false to allow cameras to move freely beyond the scene boundaries. |
| ArgumentNullException | Thrown when newScene is null. |
Binding a scene unregisters event handlers from the previous scene (if any), registers handlers with the new scene, and triggers a full refresh on the next frame. The BindToScene event fires after the binding operation completes.
If the specified scene is already bound, this method returns immediately without performing any operations.
| void Gondwana.Rendering.RenderSurfaceHost< TBackbuffer >.Dispose | ( | ) |
Releases all resources used by this RenderSurfaceHost<TBackbuffer> instance.
This method releases managed resources including the backbuffer. It does not unregister from the scene; that should be handled by the scene's disposal logic.
After calling Dispose(), this instance should not be used. Calling Dispose() multiple times is safe and has no additional effect.
|
virtual |
Releases resources used by this RenderSurfaceHost<TBackbuffer> instance.
| disposing | true to release both managed and unmanaged resources; false to release only unmanaged resources (called from finalizer). |
When disposing is true, this method releases the backbuffer and clears the reference. Derived classes should override this method to release additional resources.
Reimplemented from Gondwana.Rendering.RenderSurfaceHostBase.
| RenderSurfaceHost() Gondwana.Rendering.RenderSurfaceHost< TBackbuffer >.RenderSurfaceHost | ( | RenderSurfaceAdapterBase | renderSurfaceAdapter | ) |
Initializes a new instance of the RenderSurfaceHost<TBackbuffer> class with the specified render surface adapter.
| renderSurfaceAdapter | The platform-specific adapter that provides the underlying rendering surface. |
| ArgumentNullException | Thrown if renderSurfaceAdapter is null. |
| InvalidOperationException | Thrown if the adapter has non-positive dimensions. |
|
get |
Gets the backbuffer used for off-screen rendering before presentation to the adapter.
The BackbufferBase instance managing the render target canvas and dirty-rectangle tracking.
The backbuffer holds the rendered frame content and tracks which regions have changed since the last presentation. All rendering operations are performed on the backbuffer's canvas before being copied to the UI adapter during presentation.
|
getset |
Gets or sets a value indicating whether only the dirty (changed) regions of the backbuffer are presented to the adapter each frame.
true to present only dirty regions (default); false to present the entire backbuffer every frame.
Enabling dirty-rectangle-only presentation improves performance by reducing the amount of data transferred to the UI adapter. Disable this when troubleshooting rendering issues or when the adapter does not support partial updates.
|
get |
Gets the platform-specific adapter that provides the underlying rendering surface.
The RenderSurfaceAdapterBase instance representing the UI control or window where rendered content is displayed.
The adapter handles platform-specific presentation details and provides size/resize notifications. The backbuffer dimensions are synchronized with the adapter's size.
Gets the scene currently bound to this render surface host.
The Scene instance being rendered, or Scene.Empty if no scene is bound.
The scene contains all layers, sprites, and direct drawings that are rendered each frame. Use Bind to change the active scene.
|
get |
Gets the view manager that controls camera positions, viewports, and multi-view rendering.
The ViewManager instance managing all views associated with this render surface host.
Use the view manager to create, configure, and remove views. Each view defines a viewport rectangle on the backbuffer, a camera position in the scene, and zoom/parallax settings. Views enable split-screen, picture-in-picture, and minimap rendering.
| EventHandler<RenderSurfaceHostBindEventArgs>? Gondwana.Rendering.RenderSurfaceHost< TBackbuffer >.BindToScene |
Occurs when a scene is bound to or unbound from this render surface host.
This event fires after the scene binding operation completes. Event handlers receive information about the previously bound scene (if any) and the newly bound scene. Use this event to respond to scene changes, such as updating UI elements or resetting state that depends on the active scene.
| Action Gondwana.Rendering.RenderSurfaceHost< TBackbuffer >.RenderBackbufferBegin |
Occurs at the beginning of the backbuffer rendering process.
| Action Gondwana.Rendering.RenderSurfaceHost< TBackbuffer >.RenderBackbufferEnd |
Occurs at the end of the backbuffer rendering process.
| Action Gondwana.Rendering.RenderSurfaceHost< TBackbuffer >.RenderBackbufferNoOp |
Occurs when a backbuffer render operation is skipped because the scene is not dirty.