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.
Loading...
Searching...
No Matches
Gondwana.Rendering.Views.ViewManager Class Referencesealed

Manages a collection of views for a render surface, handling view creation, removal, ordering, and multi-viewport layouts. Each view combines a camera and viewport to control what portion of the scene is rendered and where it appears on screen. More...

Public Member Functions

void AddView (Rectangle targetRectPx, float zoom=1f, int zOrder=0, RectangleF? worldBoundsPx=null)
 Creates and adds a new view with the specified screen rectangle, zoom level, and Z-order. The view is automatically configured with a camera that can be optionally clamped to world bounds.
void ConfigureSingleFullView (float zoom=1f, int zOrder=0)
 Removes all existing views and creates a single full-screen view that occupies the entire render surface adapter.
void ConfigureVerticalSplit (float leftZoom=1f, float rightZoom=1f)
 Removes all existing views and creates a vertical split-screen layout: left and right views sharing the full height of the render surface.
void ConfigureHorizontalSplit (float topZoom=1f, float bottomZoom=1f)
 Removes all existing views and creates a horizontal split-screen layout: top and bottom views sharing the full width of the render surface.
void ClearViews ()
 Removes all views from the manager, unsubscribing from their events and marking the scene as needing a full refresh.
IReadOnlyList< ViewGetViewsBelow (View view)
 Returns all views that are rendered behind (below) the specified view, based on Z-order. Views with lower Z-order values appear behind.
IReadOnlyList< ViewGetViewsAbove (View view)
 Returns all views that are rendered in front of (above) the specified view, based on Z-order. Views with higher Z-order values appear in front.

Properties

ReadOnlyCollection< ViewViews [get]
 Gets a read-only collection of all views currently managed by this view manager. Views are sorted by Z-order, with lower values appearing first (drawn behind).

Detailed Description

Manages a collection of views for a render surface, handling view creation, removal, ordering, and multi-viewport layouts. Each view combines a camera and viewport to control what portion of the scene is rendered and where it appears on screen.

Member Function Documentation

◆ AddView()

void Gondwana.Rendering.Views.ViewManager.AddView ( Rectangle targetRectPx,
float zoom = 1f,
int zOrder = 0,
RectangleF? worldBoundsPx = null )

Creates and adds a new view with the specified screen rectangle, zoom level, and Z-order. The view is automatically configured with a camera that can be optionally clamped to world bounds.

Parameters
targetRectPxThe screen-space rectangle (in pixels) where this view will be rendered on the render surface.
zoomInitial zoom factor for the view. Values greater than 1 zoom in; values less than 1 zoom out. Default is 1 (no zoom).
zOrderDraw order relative to other views. Lower values are drawn first (behind); higher values are drawn later (in front). Default is 0.
worldBoundsPxOptional world-space bounds (in pixels) that limit where the camera can move. If null or RectangleF.Empty, the camera has no movement constraints.

The newly created view's camera is initially positioned at world origin (0,0) and configured to snap to targets without smoothing. The view is automatically sorted by Z-order after being added.

◆ ClearViews()

void Gondwana.Rendering.Views.ViewManager.ClearViews ( )

Removes all views from the manager, unsubscribing from their events and marking the scene as needing a full refresh.

This method cleanly detaches event handlers from each view's viewport before clearing the collection. After clearing, the scene is flagged for a full refresh to update the rendering state.

◆ ConfigureHorizontalSplit()

void Gondwana.Rendering.Views.ViewManager.ConfigureHorizontalSplit ( float topZoom = 1f,
float bottomZoom = 1f )

Removes all existing views and creates a horizontal split-screen layout: top and bottom views sharing the full width of the render surface.

Parameters
topZoomInitial zoom for the top view.
bottomZoomInitial zoom for the bottom view.

◆ ConfigureSingleFullView()

void Gondwana.Rendering.Views.ViewManager.ConfigureSingleFullView ( float zoom = 1f,
int zOrder = 0 )

Removes all existing views and creates a single full-screen view that occupies the entire render surface adapter.

Parameters
zoomInitial zoom level for the view.
zOrderZ-order for the view (default 0).

◆ ConfigureVerticalSplit()

void Gondwana.Rendering.Views.ViewManager.ConfigureVerticalSplit ( float leftZoom = 1f,
float rightZoom = 1f )

Removes all existing views and creates a vertical split-screen layout: left and right views sharing the full height of the render surface.

Parameters
leftZoomInitial zoom for the left view.
rightZoomInitial zoom for the right view.

◆ GetViewsAbove()

IReadOnlyList< View > Gondwana.Rendering.Views.ViewManager.GetViewsAbove ( View view)

Returns all views that are rendered in front of (above) the specified view, based on Z-order. Views with higher Z-order values appear in front.

Parameters
viewThe reference view to find views above.
Returns
A read-only list of views with higher Z-order than the specified view. Returns an empty collection if the view is not found or is already the top-most view.

◆ GetViewsBelow()

IReadOnlyList< View > Gondwana.Rendering.Views.ViewManager.GetViewsBelow ( View view)

Returns all views that are rendered behind (below) the specified view, based on Z-order. Views with lower Z-order values appear behind.

Parameters
viewThe reference view to find views below.
Returns
A read-only list of views with lower Z-order than the specified view. Returns an empty collection if the view is not found or is already the bottom-most view.

Property Documentation

◆ Views

ReadOnlyCollection<View> Gondwana.Rendering.Views.ViewManager.Views
get

Gets a read-only collection of all views currently managed by this view manager. Views are sorted by Z-order, with lower values appearing first (drawn behind).

A ReadOnlyCollection<T> of View instances.