![]() |
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.
|
Represents a rendered view of a scene, combining a camera position with a viewport configuration to control what portion of the world is visible and how it is displayed on screen. Multiple views can be used to create split-screen, picture-in-picture, or other multi-viewport rendering scenarios. More...
Public Member Functions | |
| void | ZoomAroundScreenPoint (SceneLayer layer, PointF screenPoint, float targetZoom, float durationSeconds) |
| Smoothly zooms the view so that a given screen-space point appears to zoom in/out around a fixed world position beneath it, similar to map-style mouse-wheel zoom. Both the viewport zoom and camera position are animated over the specified duration. | |
| PointF | ScreenPxToWorldPx (SceneLayer layer, PointF screenPx) |
| Converts a screen-space pixel position into world-space coordinates for the specified scene layer, accounting for the view's camera position, viewport zoom, screen offsets, and the layer's parallax factor. | |
| PointF | WorldPxToScreenPx (SceneLayer layer, PointF worldPx) |
| Converts a world-space pixel position into screen-space coordinates for this view, accounting for the camera position, viewport zoom, screen offsets, and the specified layer's parallax factor. | |
| PointF | ScreenPxToGrid (SceneLayer layer, PointF screenPx) |
| Converts a point in screen-space into the grid coordinate on the specified SceneLayer by first mapping the screen pixel to world-space, then letting the layer's coordinate system resolve the corresponding tile. | |
| RectangleF | WorldRectToScreenRect (SceneLayer layer, RectangleF worldRect) |
| Converts a world-space pixel rectangle into a screen-space rectangle for this View, using the specified layer's parallax factor. | |
| RectangleF | ScreenRectToWorldRect (SceneLayer layer, RectangleF screenRect) |
| Converts a screen-space rectangle (on the adapter) into a world-space rectangle for the given layer, respecting zoom, camera position, viewport offsets, and the layer's parallax factor. | |
Properties | |
| Guid | Id = Guid.NewGuid() [get] |
| Gets the unique identifier for this view instance. | |
| Camera | Camera [get] |
| Gets the camera that controls the world-space position and following behavior for this view. The camera determines which part of the world is visible. | |
| Viewport | Viewport [get] |
| Gets the viewport that defines the screen-space rectangle, zoom level, and other rendering parameters for this view. The viewport controls how the camera's visible world region is mapped to screen pixels. | |
| int | ZOrder = 0 [get, set] |
| Controls the draw order of this view relative to other views. Lower values are drawn first (behind); higher values are drawn later (in front). | |
Represents a rendered view of a scene, combining a camera position with a viewport configuration to control what portion of the world is visible and how it is displayed on screen. Multiple views can be used to create split-screen, picture-in-picture, or other multi-viewport rendering scenarios.
| PointF Gondwana.Rendering.Views.View.ScreenPxToGrid | ( | SceneLayer | layer, |
| PointF | screenPx ) |
Converts a point in screen-space into the grid coordinate on the specified SceneLayer by first mapping the screen pixel to world-space, then letting the layer's coordinate system resolve the corresponding tile.
| layer | The SceneLayer whose grid the point should be mapped onto. |
| screenPx | The pixel position relative to the RenderSurface. |
| PointF Gondwana.Rendering.Views.View.ScreenPxToWorldPx | ( | SceneLayer | layer, |
| PointF | screenPx ) |
Converts a screen-space pixel position into world-space coordinates for the specified scene layer, accounting for the view's camera position, viewport zoom, screen offsets, and the layer's parallax factor.
| layer | The scene layer whose parallax factor should be used for the conversion. |
| screenPx | The screen-space pixel position relative to the render surface. |
The transformation formula is:
This is commonly used for mouse picking and screen-to-world raycasting.
| RectangleF Gondwana.Rendering.Views.View.ScreenRectToWorldRect | ( | SceneLayer | layer, |
| RectangleF | screenRect ) |
Converts a screen-space rectangle (on the adapter) into a world-space rectangle for the given layer, respecting zoom, camera position, viewport offsets, and the layer's parallax factor.
Inverse of: screen = offset + (world - camera * p) / zoom
| PointF Gondwana.Rendering.Views.View.WorldPxToScreenPx | ( | SceneLayer | layer, |
| PointF | worldPx ) |
Converts a world-space pixel position into screen-space coordinates for this view, accounting for the camera position, viewport zoom, screen offsets, and the specified layer's parallax factor.
| layer | The scene layer whose parallax factor should be used for the conversion. |
| worldPx | The world-space pixel position to convert. |
The transformation formula is:
This is commonly used for rendering world objects to screen coordinates and for UI elements that track world positions.
| RectangleF Gondwana.Rendering.Views.View.WorldRectToScreenRect | ( | SceneLayer | layer, |
| RectangleF | worldRect ) |
Converts a world-space pixel rectangle into a screen-space rectangle for this View, using the specified layer's parallax factor.
Matches the render path: screen = offset + (world - camera * parallax) / zoom
| layer | Scene layer whose parallax should be applied. |
| worldRect | World-space rectangle (in pixels). |
| void Gondwana.Rendering.Views.View.ZoomAroundScreenPoint | ( | SceneLayer | layer, |
| PointF | screenPoint, | ||
| float | targetZoom, | ||
| float | durationSeconds ) |
Smoothly zooms the view so that a given screen-space point appears to zoom in/out around a fixed world position beneath it, similar to map-style mouse-wheel zoom. Both the viewport zoom and camera position are animated over the specified duration.
| layer | Reference layer whose parallax factor is used for the world-space transform. Typically the main gameplay layer (parallax = 1). |
| screenPoint | Mouse position in adapter/screen pixels relative to the render surface. |
| targetZoom | Desired zoom factor after the animation completes. |
| durationSeconds | Approximate duration in seconds for the zoom + pan animation. Values <= 0 snap immediately. |
|
get |
Gets the camera that controls the world-space position and following behavior for this view. The camera determines which part of the world is visible.
The Views.Camera instance associated with this view.
|
get |
Gets the unique identifier for this view instance.
A GUID that uniquely identifies this view throughout its lifetime.
|
get |
Gets the viewport that defines the screen-space rectangle, zoom level, and other rendering parameters for this view. The viewport controls how the camera's visible world region is mapped to screen pixels.
The Views.Viewport instance associated with this view.
|
getset |
Controls the draw order of this view relative to other views. Lower values are drawn first (behind); higher values are drawn later (in front).