fledge_camera_2d library
2D camera components and cinematics for Fledge.
Extracted from fledge_render_2d in Phase 6a. Depends on
fledge_render_2d for the CameraView and Viewport types that
flow through the render graph — the reverse dependency does not
exist.
Contents
- Camera2D, Projection, OrthographicProjection, IsometricProjection, ObliqueProjection — camera + projections.
- CameraDriverNode, CameraDriverContext — render-graph glue.
- CameraFollow + CameraFollowSystem — smooth follow.
- CameraShake + CameraShakeSystem — trauma-based shake.
- Parallax + ParallaxSystem — parallax scrolling.
- CameraFadeTransition, CameraWipeTransition + CameraTransitionSystem — fade / wipe.
- LetterboxConfig, computeLetterbox, computeGutter — letterbox helpers.
- ViewportSize — viewport-size resource used by extractors.
- PixelPerfectVector2 — snap-to-pixel helpers.
- CameraPlugin — wires the systems into an
App.
Classes
- ActiveCameraViewSystem
-
Publishes the active camera's world position into
ActiveCameraVieweach frame sofledge_render_2d's widget render path (FledgeRenderView,LitFledgeRenderView,DebugGizmosLayer) can translate the canvas to follow it. - Camera2D
- 2D camera component.
- CameraDriverContext
- Context for the camera driver node.
- CameraDriverNode
- Render node that sets up the camera for subsequent nodes.
- CameraFadeTransition
- A screen-tinting fade transition.
- CameraFollow
- Component making a Camera2D entity smoothly follow another entity.
- CameraFollowSystem
- System that updates every camera with a CameraFollow component.
- CameraFollowTarget
- Marker component that identifies the current camera-follow target.
- CameraPlugin
-
Plugin that wires camera systems into an
App. - CameraShake
- Trauma-based screen shake component.
- CameraShakeSystem
-
System that decays trauma and applies per-frame shake to camera
Transform2Ds. - CameraTransition
- Base type for camera-level fade / wipe transitions.
- CameraTransitionSystem
- System that advances CameraTransition.elapsed each frame.
- CameraWipeTransition
- A directional wipe transition.
- IsometricProjection
- Isometric projection with a 2:1 aspect ratio.
- LetterboxConfig
- Optional letterbox / pillarbox configuration.
- ObliqueProjection
- Parametric oblique projection.
- OrthographicProjection
- Orthographic projection settings for 2D rendering.
- Parallax
- Parallax multiplier for a background/foreground entity.
- ParallaxSystem
-
System that adjusts
GlobalTransform2Dof parallax entities based on the active camera position. - Projection
- Common interface for all camera projections.
- ViewportSize
- Resource that stores the current viewport (screen) dimensions.
Enums
- ScalingMode
- Scaling mode for orthographic projection.
- WipeDirection
- Direction of a CameraWipeTransition.
Extensions
- PixelPerfectVector2 on Vector2
- Extension methods for pixel-perfect Vector2 operations.
Functions
-
computeGutter(
RenderSize viewport, Rect gameRect) → List< Rect> - The gutter regions (black bars) around a letterboxed game rect.
-
computeLetterbox(
RenderSize viewport, double targetAspect) → Rect -
Compute the game rect inside
viewportthat preservestargetAspect. If the viewport is wider than the target, this centres horizontally (pillarbox). If narrower, it centres vertically (letterbox). -
snapToPixel(
double value) → double - Utilities for pixel-perfect 2D rendering.
-
snapVector2ToPixel(
Vector2 position) → Vector2 - Snap a Vector2 position to the nearest pixel.
-
snapVector2ToPixelInPlace(
Vector2 position) → void - Snap a Vector2 position to pixels, modifying in place.