![]() |
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.
|
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 | FollowAt (Func< PointF > getWorldPixel, PointF viewportAnchor, bool hardFollow=false) |
| Configures the camera to follow a dynamically supplied world-space target while keeping that target at a normalized position within the visible view. | |
| 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 | FollowAt (IMovableOnSceneLayer target, PointF viewportAnchor, float speed=-1f, bool hard=false) |
| Makes the camera follow an IMovable-on-SceneLayer while keeping the object's center at a normalized position within the visible view. | |
| 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 | FollowAtX (IMovableOnSceneLayer target, float horizontalAnchor, float speed=-1f, bool hard=false) |
| Smoothly follows an IMovable target horizontally while keeping its center at a normalized horizontal position in the visible view. 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 | FollowAtY (IMovableOnSceneLayer target, float verticalAnchor, float speed=-1f, bool hard=false) |
| Smoothly follows an IMovable target vertically while keeping its center at a normalized vertical position in the visible view. 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. Wrapped axes are unconstrained in the selected layer's period-vector basis. Following uses the target layer; otherwise the first visible layer in scene insertion order supplies topology. | |
| 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 ) |
| 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.
| layer | The layer. |
| col | The col. |
| row | The row. |
| void Gondwana.Rendering.Views.Camera.ClearFollow | ( | ) |
| 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.FollowAt | ( | Func< PointF > | getWorldPixel, |
| PointF | viewportAnchor, | ||
| bool | hardFollow = false ) |
Configures the camera to follow a dynamically supplied world-space target while keeping that target at a normalized position within the visible view.
| getWorldPixel | Function that returns the target world-space point of interest each frame. |
| viewportAnchor | Normalized position within the visible view, where (0, 0) is the upper-left and (1, 1) is the lower-right. For example, (0.2, 0.5) keeps the target 20% from the left and vertically centered. |
| hardFollow | If true, the camera snaps directly to the desired position (no smoothing). If false, the camera smoothly lerps toward the target using FollowLerpPerSecond. |
When DeadZonePx is non-empty, the dead zone owns target containment and the anchor is used as the follow reference for wrapped worlds. World-bound clamping can also prevent the requested anchor from being reached near a scene edge.
| void Gondwana.Rendering.Views.Camera.FollowAt | ( | IMovableOnSceneLayer | target, |
| PointF | viewportAnchor, | ||
| float | speed = -1f, | ||
| bool | hard = false ) |
Makes the camera follow an IMovable-on-SceneLayer while keeping the object's center at a normalized position within the visible view.
| target | Object whose world-space center should be followed. |
| viewportAnchor | Normalized position within the visible view, where (0, 0) is the upper-left and (1, 1) is the lower-right. |
| speed | Follow speed in lerp-units per second. Values greater than zero replace FollowLerpPerSecond; values less than or equal to zero leave the current setting unchanged. |
| hard | If true, the camera snaps to the desired position each update. |
| void Gondwana.Rendering.Views.Camera.FollowAtX | ( | IMovableOnSceneLayer | target, |
| float | horizontalAnchor, | ||
| float | speed = -1f, | ||
| bool | hard = false ) |
Smoothly follows an IMovable target horizontally while keeping its center at a normalized horizontal position in the visible view. Vertical camera position is left unchanged.
| target | Object whose horizontal world position should be followed. |
| horizontalAnchor | Normalized horizontal position where 0 is the left edge and 1 is the right edge. |
| speed | Follow speed in lerp-units per second. Values greater than zero replace FollowLerpPerSecond. |
| hard | If true, the camera snaps to the desired horizontal position each update. |
| void Gondwana.Rendering.Views.Camera.FollowAtY | ( | IMovableOnSceneLayer | target, |
| float | verticalAnchor, | ||
| float | speed = -1f, | ||
| bool | hard = false ) |
Smoothly follows an IMovable target vertically while keeping its center at a normalized vertical position in the visible view. Horizontal camera position is left unchanged.
| target | Object whose vertical world position should be followed. |
| verticalAnchor | Normalized vertical position where 0 is the top edge and 1 is the bottom edge. |
| speed | Follow speed in lerp-units per second. Values greater than zero replace FollowLerpPerSecond. |
| hard | If true, the camera snaps to the desired vertical position each update. |
| 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.
| target | The target. |
| speed | The speed. |
| hard | Whether the light uses a hard edge. |
| void Gondwana.Rendering.Views.Camera.FollowCenteredX | ( | IMovableOnSceneLayer | target, |
| float | speed = -1f, | ||
| bool | hard = false ) |
| void Gondwana.Rendering.Views.Camera.FollowCenteredY | ( | IMovableOnSceneLayer | target, |
| float | speed = -1f, | ||
| bool | hard = false ) |
| 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 | ) |
| 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 |
|
getset |
|
get |
|
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. Wrapped axes are unconstrained in the selected layer's period-vector basis. Following uses the target layer; otherwise the first visible layer in scene insertion order supplies topology.