![]() |
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 world-space camera for a Scene. The camera tracks a world-space upper-left position in pixels and is used by Views to determine which part of the Scene is visible. It supports snapping, smooth follow, dead zones, and clamping to world bounds. More...
Public Member Functions | |
| void | SnapTo (PointF worldUpperLeftPx) |
| Instantly moves the camera to the specified world-space position, interpreted as the upper-left corner of the visible region. Any active smooth follow or pan continues from this new position. | |
| void | CenterOn (PointF worldCenterPx) |
| Instantly repositions the camera so that the given world-space point appears at the center of the view. Uses the current visible world size to compute the appropriate camera upper-left position. | |
| void | CenterOnGrid (SceneLayer layer, int col, int row) |
| Instantly centers the camera on the specified tile in the given SceneLayer. The tile's visual center is placed at the center of the view. | |
| void | PanCenterTo (PointF worldCenterPx, float speed) |
| Smoothly pans the camera so that the given world-space point ends up at the center of the visible view, using the given follow speed. | |
| void | AnimateCenterOnGrid (SceneLayer layer, int col, int row, float speed) |
| Smoothly pans the camera until the specified grid tile is centered in the view. Uses the given follow speed for the motion. | |
| void | PanTo (PointF worldTopLeftPx, float speed) |
| Smoothly pans the camera toward a world-space top-left position for the view, using the given follow speed. This interprets the input as the desired camera upper-left, not a center point. | |
| void | PanCenterToOnce (PointF worldCenterPx, float speed) |
| Smoothly pans the camera so that the specified world-space point becomes the visual center of the view, then stops. Unlike PanCenterTo, this is a one-shot cinematic pan and does not continue tracking the point after the camera arrives. | |
| void | PanToOverDuration (PointF worldTopLeftPx, float durationSeconds) |
| Smoothly pans the camera so that its upper-left pixel reaches the specified world-space target over approximately the given duration. This uses the same exponential smoothing model as PanTo, but computes an appropriate lerp rate so the camera covers ~99% of the distance in the requested time. | |
| void | PanCenterToOverDuration (PointF worldCenterPx, float durationSeconds) |
| Smoothly pans the camera so that the specified world-space point becomes the visual center of the view over approximately the given duration, then stops. Unlike PanCenterTo, this is a one-shot cinematic pan and does not continue tracking the point afterward. | |
| void | PanToGridOverDuration (SceneLayer layer, int col, int row, float durationSeconds) |
| Smoothly pans the camera so that the specified grid tile becomes the visual center of the view over approximately the given duration. This is a one-shot cinematic pan to a tile, not a continuous follow. | |
| void | PanBy (PointF deltaPx) |
| Instantly pans the camera by the given offset in world-space pixels. This adds the offset to the current camera position without changing any follow or pan targets. | |
| void | Follow (Func< PointF > getWorldPixel, bool hardFollow=false) |
| Configures the camera to follow a dynamically supplied world-space target position. Each update, the supplier is called to get the desired target "point of interest" in world pixels (typically a character center), and the camera moves so that point stays visible, honoring dead-zones and clamping. | |
| void | FollowTo (PointF worldPointOfInterestPx) |
| Starts smooth camera movement toward a fixed world-space "point of
interest" (typically a center point). Uses the same follow logic as Follow(Func<PointF>, bool) but with a constant target. | |
| void | FollowCentered (IMovableOnSceneLayer target, float speed=-1f, bool hard=false) |
| Makes the camera follow an IMovable-on-SceneLayer so that the object stays centered in the view. Supports both grid-space and pixel-space movement, using the current coordinate system for the layer. | |
| void | FollowCenteredX (IMovableOnSceneLayer target, float speed=-1f, bool hard=false) |
| Smoothly follows an IMovable target, centering it horizontally only. Vertical camera position is left unchanged. | |
| void | FollowCenteredY (IMovableOnSceneLayer target, float speed=-1f, bool hard=false) |
| Smoothly follows an IMovable target, centering it vertically only. Horizontal camera position is left unchanged. | |
| void | ClearFollow () |
| Clears any active follow or pan targets; the camera remains at its current position until moved again. | |
Properties | |
| PointF | PositionPx [get] |
| Gets or sets the camera's world-space position in pixels, interpreted as the upper-left corner of the visible region. All world-to-screen projections for this camera are based on this position. | |
| RectangleF | WorldBoundsPx = RectangleF.Empty [get, set] |
| World-space rectangle (in pixels) that the camera is allowed to move within. Clamping logic uses this to prevent the view from scrolling past the edges of the world or map. | |
| Rectangle | DeadZonePx = Rectangle.Empty [get, set] |
| Size of the dead zone, in pixels, around the center of the view where the follow target is allowed to move without forcing the camera to track it. A larger dead zone produces a looser, less reactive camera. | |
| float | FollowLerpPerSecond = 8f [get, set] |
| Controls how quickly the camera moves toward its follow target when smooth follow is enabled. Interpreted as a lerp factor per second: higher values feel snappier, lower values feel more floaty. | |
Represents a world-space camera for a Scene. The camera tracks a world-space upper-left position in pixels and is used by Views to determine which part of the Scene is visible. It supports snapping, smooth follow, dead zones, and clamping to world bounds.
| void Gondwana.Rendering.Views.Camera.AnimateCenterOnGrid | ( | SceneLayer | layer, |
| int | col, | ||
| int | row, | ||
| float | speed ) |
Smoothly pans the camera until the specified grid tile is centered in the view. Uses the given follow speed for the motion.
| void Gondwana.Rendering.Views.Camera.CenterOn | ( | PointF | worldCenterPx | ) |
Instantly repositions the camera so that the given world-space point appears at the center of the view. Uses the current visible world size to compute the appropriate camera upper-left position.
| worldCenterPx | World-space pixel position that should be centered on screen. |
| void Gondwana.Rendering.Views.Camera.CenterOnGrid | ( | SceneLayer | layer, |
| int | col, | ||
| int | row ) |
Instantly centers the camera on the specified tile in the given SceneLayer. The tile's visual center is placed at the center of the view.
| void Gondwana.Rendering.Views.Camera.ClearFollow | ( | ) |
Clears any active follow or pan targets; the camera remains at its current position until moved again.
| void Gondwana.Rendering.Views.Camera.Follow | ( | Func< PointF > | getWorldPixel, |
| bool | hardFollow = false ) |
Configures the camera to follow a dynamically supplied world-space target position. Each update, the supplier is called to get the desired target "point of interest" in world pixels (typically a character center), and the camera moves so that point stays visible, honoring dead-zones and clamping.
| getWorldPixel | Function that returns the target world-space point of interest each frame. |
| hardFollow | If true, the camera snaps directly to the desired position (no smoothing). If false, the camera smoothly lerps toward the target using FollowLerpPerSecond. |
| void Gondwana.Rendering.Views.Camera.FollowCentered | ( | IMovableOnSceneLayer | target, |
| float | speed = -1f, | ||
| bool | hard = false ) |
Makes the camera follow an IMovable-on-SceneLayer so that the object stays centered in the view. Supports both grid-space and pixel-space movement, using the current coordinate system for the layer.
| void Gondwana.Rendering.Views.Camera.FollowCenteredX | ( | IMovableOnSceneLayer | target, |
| float | speed = -1f, | ||
| bool | hard = false ) |
Smoothly follows an IMovable target, centering it horizontally only. Vertical camera position is left unchanged.
| void Gondwana.Rendering.Views.Camera.FollowCenteredY | ( | IMovableOnSceneLayer | target, |
| float | speed = -1f, | ||
| bool | hard = false ) |
Smoothly follows an IMovable target, centering it vertically only. Horizontal camera position is left unchanged.
| void Gondwana.Rendering.Views.Camera.FollowTo | ( | PointF | worldPointOfInterestPx | ) |
Starts smooth camera movement toward a fixed world-space "point of interest" (typically a center point). Uses the same follow logic as Follow(Func<PointF>, bool) but with a constant target.
| worldPointOfInterestPx | World-space pixel position of the target point of interest. |
| void Gondwana.Rendering.Views.Camera.PanBy | ( | PointF | deltaPx | ) |
Instantly pans the camera by the given offset in world-space pixels. This adds the offset to the current camera position without changing any follow or pan targets.
| void Gondwana.Rendering.Views.Camera.PanCenterTo | ( | PointF | worldCenterPx, |
| float | speed ) |
Smoothly pans the camera so that the given world-space point ends up at the center of the visible view, using the given follow speed.
| worldCenterPx | World-space pixel position that should appear in the center of the view. |
| speed | Follow speed in lerp-units per second. Higher values feel snappier, lower values feel more floaty. |
| void Gondwana.Rendering.Views.Camera.PanCenterToOnce | ( | PointF | worldCenterPx, |
| float | speed ) |
Smoothly pans the camera so that the specified world-space point becomes the visual center of the view, then stops. Unlike PanCenterTo, this is a one-shot cinematic pan and does not continue tracking the point after the camera arrives.
| worldCenterPx | World-space pixel position that should end up at the center of the view. |
| speed | Pan speed in lerp-units per second. Higher values feel snappier, lower values feel more floaty. If <= 0, the camera snaps immediately to the target center. |
| void Gondwana.Rendering.Views.Camera.PanCenterToOverDuration | ( | PointF | worldCenterPx, |
| float | durationSeconds ) |
Smoothly pans the camera so that the specified world-space point becomes the visual center of the view over approximately the given duration, then stops. Unlike PanCenterTo, this is a one-shot cinematic pan and does not continue tracking the point afterward.
| worldCenterPx | World-space pixel position that should end up at the center of the view. |
| durationSeconds | Approximate time (in seconds) for the camera to reach the target center. Values <= 0 cause an immediate snap to the destination. |
| void Gondwana.Rendering.Views.Camera.PanTo | ( | PointF | worldTopLeftPx, |
| float | speed ) |
Smoothly pans the camera toward a world-space top-left position for the view, using the given follow speed. This interprets the input as the desired camera upper-left, not a center point.
| worldTopLeftPx | World-space pixel position for the camera's upper-left corner. |
| speed | Pan speed in lerp-units per second. Higher values feel snappier, lower values feel more floaty. If <= 0, the camera snaps. |
| void Gondwana.Rendering.Views.Camera.PanToGridOverDuration | ( | SceneLayer | layer, |
| int | col, | ||
| int | row, | ||
| float | durationSeconds ) |
Smoothly pans the camera so that the specified grid tile becomes the visual center of the view over approximately the given duration. This is a one-shot cinematic pan to a tile, not a continuous follow.
| layer | Scene layer the grid position belongs to. |
| col | Grid column of the tile to center on. |
| row | Grid row of the tile to center on. |
| durationSeconds | Approximate time (in seconds) for the camera to reach the target cell. Values <= 0 cause an immediate snap to the destination. |
| void Gondwana.Rendering.Views.Camera.PanToOverDuration | ( | PointF | worldTopLeftPx, |
| float | durationSeconds ) |
Smoothly pans the camera so that its upper-left pixel reaches the specified world-space target over approximately the given duration. This uses the same exponential smoothing model as PanTo, but computes an appropriate lerp rate so the camera covers ~99% of the distance in the requested time.
| worldTopLeftPx | Desired world-space pixel position for the camera's upper-left corner. |
| durationSeconds | Approximate time (in seconds) for the camera to reach the target. Values <= 0 cause an immediate snap to the destination. |
| void Gondwana.Rendering.Views.Camera.SnapTo | ( | PointF | worldUpperLeftPx | ) |
Instantly moves the camera to the specified world-space position, interpreted as the upper-left corner of the visible region. Any active smooth follow or pan continues from this new position.
| worldUpperLeftPx | World-space pixel position for the camera's upper-left corner. |
|
getset |
Size of the dead zone, in pixels, around the center of the view where the follow target is allowed to move without forcing the camera to track it. A larger dead zone produces a looser, less reactive camera.
|
getset |
Controls how quickly the camera moves toward its follow target when smooth follow is enabled. Interpreted as a lerp factor per second: higher values feel snappier, lower values feel more floaty.
|
get |
Gets or sets the camera's world-space position in pixels, interpreted as the upper-left corner of the visible region. All world-to-screen projections for this camera are based on this position.
|
getset |
World-space rectangle (in pixels) that the camera is allowed to move within. Clamping logic uses this to prevent the view from scrolling past the edges of the world or map.