![]() |
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.
|
A rectangular window on the render target with its own zoom and placement. Viewport never moves the world; it only scales and positions the drawing. More...
Public Member Functions | |
| void | Resize (int width, int height) |
| Updates the viewport size while preserving its current on-screen origin. This is a convenience around TargetRectPx that only changes the width and height. | |
| void | SnapZoom (float zoom) |
| Instantly sets the zoom level, raising the ZoomChanged event. | |
| void | ZoomTo (float targetZoom, float lerpPerSecond) |
| Smoothly animates the zoom toward a target level using an exponential lerp rate in "per second" units. Values <= 0 snap immediately. | |
| void | ZoomToOverDuration (float targetZoom, float durationSeconds) |
| Smoothly animates the zoom using exponential easing and snaps exactly to the target when the requested duration has elapsed. Values <= 0 snap. | |
Properties | |
| Rectangle | TargetRectPx [get, set] |
| Screen-space rectangle (in SCREEN / RenderSurface pixels) where this view is drawn. This defines the on-screen position and size of the viewport for this view. | |
| float | Zoom [get, set] |
| Zoom factor applied to the world when rendering this view. Values greater than 1 zoom in, values between 0 and 1 zoom out. Used when converting between screen-space and world-space pixels. | |
| PointF | ScreenOffsetPx = PointF.Empty [get, set] |
| Optional per-view HUD/safe-area offset in screen pixels. | |
| SizeF | VisibleWorldSizePx [get] |
| World size visible through this viewport (used for Camera clamping). | |
Events | |
| Action< ViewportResizedEventArgs >? | TargetRectChanged |
| Fired whenever TargetRectPx changes (viewport resized or moved). Provides the Viewport instance and the old and new rectangles. | |
| Action< ViewportZoomChangedEventArgs >? | ZoomChanged |
| Occurs when the zoom level of the viewport changes. | |
A rectangular window on the render target with its own zoom and placement. Viewport never moves the world; it only scales and positions the drawing.
Definition at line 9 of file Viewport.cs.
| void Gondwana.Rendering.Views.Viewport.Resize | ( | int | width, |
| int | height ) |
Updates the viewport size while preserving its current on-screen origin. This is a convenience around TargetRectPx that only changes the width and height.
| width | New viewport width in pixels. |
| height | New viewport height in pixels. |
Definition at line 55 of file Viewport.cs.
| void Gondwana.Rendering.Views.Viewport.SnapZoom | ( | float | zoom | ) |
Instantly sets the zoom level, raising the ZoomChanged event.
| zoom | The zoom factor. |
Definition at line 95 of file Viewport.cs.
| void Gondwana.Rendering.Views.Viewport.ZoomTo | ( | float | targetZoom, |
| float | lerpPerSecond ) |
Smoothly animates the zoom toward a target level using an exponential lerp rate in "per second" units. Values <= 0 snap immediately.
| targetZoom | The zoom factor to reach at the end of the effect. |
| lerpPerSecond | The lerp per second. |
Definition at line 112 of file Viewport.cs.
| void Gondwana.Rendering.Views.Viewport.ZoomToOverDuration | ( | float | targetZoom, |
| float | durationSeconds ) |
Smoothly animates the zoom using exponential easing and snaps exactly to the target when the requested duration has elapsed. Values <= 0 snap.
| targetZoom | The zoom factor to reach at the end of the effect. |
| durationSeconds | The duration in seconds. |
Definition at line 133 of file Viewport.cs.
|
getset |
Optional per-view HUD/safe-area offset in screen pixels.
Definition at line 81 of file Viewport.cs.
|
getset |
Screen-space rectangle (in SCREEN / RenderSurface pixels) where this view is drawn. This defines the on-screen position and size of the viewport for this view.
Definition at line 34 of file Viewport.cs.
|
get |
World size visible through this viewport (used for Camera clamping).
Definition at line 84 of file Viewport.cs.
|
getset |
Zoom factor applied to the world when rendering this view. Values greater than 1 zoom in, values between 0 and 1 zoom out. Used when converting between screen-space and world-space pixels.
Definition at line 66 of file Viewport.cs.
| Action<ViewportResizedEventArgs>? Gondwana.Rendering.Views.Viewport.TargetRectChanged |
Fired whenever TargetRectPx changes (viewport resized or moved). Provides the Viewport instance and the old and new rectangles.
Definition at line 23 of file Viewport.cs.
| Action<ViewportZoomChangedEventArgs>? Gondwana.Rendering.Views.Viewport.ZoomChanged |
Occurs when the zoom level of the viewport changes.
Definition at line 28 of file Viewport.cs.