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.
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 logical Backbuffer.
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< View > 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.
IReadOnlyList< View > 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.

Properties

ReadOnlyCollection< View > 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).

Events

Action< View >? ViewAdded
 Occurs after a new View is added.
Action< View >? ViewRemoved
 Occurs after a View is removed.

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.

Definition at line 13 of file ViewManager.cs.

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.

Definition at line 70 of file ViewManager.cs.

◆ 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.

Definition at line 210 of file ViewManager.cs.

◆ 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.

Definition at line 169 of file ViewManager.cs.

◆ 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 logical Backbuffer.

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

Definition at line 108 of file ViewManager.cs.

◆ 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.

Definition at line 131 of file ViewManager.cs.

◆ 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.

Definition at line 259 of file ViewManager.cs.

◆ 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.

Definition at line 237 of file ViewManager.cs.

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.

Definition at line 42 of file ViewManager.cs.

Event Documentation

◆ ViewAdded

Action<View>? Gondwana.Rendering.Views.ViewManager.ViewAdded

Occurs after a new View is added.

Definition at line 21 of file ViewManager.cs.

◆ ViewRemoved

Action<View>? Gondwana.Rendering.Views.ViewManager.ViewRemoved

Occurs after a View is removed.

Definition at line 26 of file ViewManager.cs.