Skip to main content

Crate repame_sprite

Crate repame_sprite 

Source
Expand description

Deprecated: superseded by repame_view2d, which merges this crate with repame-actors into the one 2D viewport crate. Deleted at the next breaking bump; import repame-view2d in new code.

The re-export below keeps every path that lived here resolving, module paths included (repame_sprite::batch::…, repame_sprite::design::…, repame_sprite::fullscreen::…), so a consumer can move at its own pace.

Modules§

actors
Live vector actors: .ren rigs played through renamite-player. Timelines and state machines drive playback; the Canvas bridge paints. actors_view is presentational, actors_view_with takes opts. Rigs drawn many times under one world camera are the draw module instead.
batch
GPU sprite batch: instanced textured quads as a WgpuCallback. Owns the atlas texture array and instance buffer. Feeds from AtlasUploads, draws through a caller-supplied camera matrix.
camera
Camera and framing law: dp canvas in, world out, and back.
cursor
Hardware-cursor frames: one strip in, one magnified RGBA frame out.
design
Design-space conversion: a design box onto a dp canvas. This is the scale games hand-roll as grid_scale / ui_scale / world_scale, the fill-and-crop cover_fit beside the existing contain fit, and the field_size view of how much design space a canvas shows.
draw
World-anchored instanced draw list.
fullscreen
Fullscreen procedural passes: game-specific WGSL over a generated triangle, with engine-owned pipeline/uniform/texture management.
pick
Pointer picks in world space: the event vocabulary and the click rule.
sprite
Sprite data: one row per drawn quad, its blend, and its tint.

Structs§

ActorDraw
One placement of one item. Cheaper to clone than to configure.
ActorDrawList
ActorId
Index into an ActorLibrary.
ActorLibrary
ActorViewOpts
Full-control options for actors_view_with.
AtlasUpload
One pending atlas upload: blit rgba (tight w*h*4 bytes) into page at (x, y). Built from a repame-atlas drain by the game.
BatchDesc
Batch construction parameters. Pages map 1:1 onto array layers.
BatchFrame
One view’s worth of atlas draws: the sprite rows for this frame plus the shared atlas uploads. Each scene node owns its frame, so several views can batch from one atlas without sharing (and clobbering) one batch; the pixel data itself rides an Arc and is never cloned.
Camera2d
2D orthographic camera. Owned by the UI (signals), copied into the snapshot per frame. effective_center is center + offset. Canvas, GPU batch, and picks derive from these fields together.
CursorFrame
One decoded + magnified hardware-cursor frame.
DesignMapping
A design box mapped onto a dp canvas under one DesignFit policy: the scale, the offsets it implies, the inverse, and the snapping rule. Build it per frame, or on resize, from the measured canvas and the game’s design size.
FullscreenDesc
Construction parameters for one effect.
FullscreenPass
A game-owned procedural effect. Send + Sync for the compositor thread. Rebuilt from the snapshot every frame (same pattern as the sprite batch): uniforms refresh each prepare, texture uploads ride along only on change frames.
FullscreenTexture
One texture upload: tight w*h*4 RGBA8, row-major top first. Recreates the slot texture when the size changes, plain rewrite otherwise. Out-of-range or malformed uploads are dropped with a warning.
FullscreenTextureRef
Player
Topmost pickable item under pt (world space). Moved to renamite-model so canvas behaviors can hit-test without pulling the player in. See renamite_model::pick. Self-contained player: owns the project, hides the borrow plumbing.
PlayerHost
Per-surface state for one embedded player: the engine, the tessellator (SceneRenderer), the viewport fit/zoom mapping, and playback control.
RasterAtlas
Atlas resources backing ActorItem::Raster placements. The pixel data rides an Arc; every view batches its own rows per frame from it.
SpriteBatch
Per-frame snapshot batch. Send + Sync so it can cross into the compositor thread via repose_render_wgpu::Callback.
SpriteInstance
One batched sprite. uv is in atlas texels normalized to 0..1.
ViewTransform
Re-exported for embedders that paint chrome or read the view transform without depending on renamite-behavior-common directly. Screen ↔ world mapping. Px tolerance in world units.
WorldText
World-anchored text floater (damage numbers, +25).

Enums§

ActorFit
How the artboard maps onto the surface.
ActorItem
What a placement draws. One draw list carries all three media so a single surface can hold them in one z order; a rig is one kind of item, not the only kind of input.
DesignFit
Which ratio maps the design box onto the canvas. The anchoring question (“where does the box sit once the scale is picked”) stays with FitMode; this is only the ratio.
FitMode
How the world rect is framed when the canvas aspect differs from world_size. Named like Godot’s `Window.stretch/aspect.
PickEvent
PlayerError
SpriteBlend
Blend mode per sprite. Additive uses SrcAlpha + One. Sorted into ranges (alpha, then multiply, then additive): push order across blend modes is NOT preserved, see the batch module docs.
TextureFilter
Texture sampling for atlas layers.

Constants§

CLICK_SLOP_DP
Press slop in dp: pointer-up farther than this from pointer-down cancels the Click (drag-off-cancel). Density-independent: compared after dividing physical-px deltas by the painted density, so a tap cancels identically on density 1 and density 3.
MINIMAL_REN
Minimal .ren document (empty 64x64 composition, no nodes). Fixture helper for hosts built without asset files.

Traits§

FullscreenTextureUpload

Functions§

actors_view
Presentational rig surface with default opts: transparent, exact fit, no input, no auto-tick. The game applies machine inputs and ticks.
actors_view_mixed
One z-ordered world surface for all three ActorItem media. Rigs and rects are mesh placements and share the instanced mesh path; raster runs go to the atlas batch, which keeps its instancing. Because the whole list is emitted into one scene, the media interleave freely in z.
actors_view_mixed_with_events
actors_view_mixed with the PickEvent surface of actors_view_world_with_events.
actors_view_with
Rig surface with full control. Canvas size comes from layout (fill_max_size); the game sizes and layers the surface.
actors_view_world
World camera surface: every rig in library, instanced by draws.
actors_view_world_with_events
World camera surface that also reports PickEvents: press/release in world and screen space, hover, a click gated behind click_within_slop_dp, and the touch triplet.
click_within_slop_dp
Dp-space slop check: physical-px points divided by density (falling back to 1.0) before comparing against CLICK_SLOP_DP.
contain_fit
Contain-fit of a world extent into a dp-space canvas: uniform scale plus centering offsets. world_to_dp / dp_to_world invert each other for any positive scale. The fill-and-crop sibling is cover_fit (see design for the game-facing mapping).
cover_fit
Cover-fit of a design extent onto a dp canvas: uniform scale plus centering offsets, the fill-and-crop sibling of contain_fit. The design box is scaled up until it covers the canvas, so the offsets are zero on the tight axis and negative on the cropped one. design is the box contain_fit calls world; degenerate sides read as (1.0, 0.0, 0.0) like contain_fit.
cursor_frame
dp_to_world
Inverse of world_to_dp. Degenerate scales return the look point.
dp_to_world_with_roll
Inverse of world_to_dp_with_roll.
draw_batch
Draw the default batch (backward compat for single-batch apps).
draw_batch_with_id
Draw the prepared batch for one id. Shared by SpriteBatch and viewport payloads so all GPU consumers issue identical draw calls.
effective_fit
Effective fit for one frame: base contain-fit scaled by zoom / units_per_pixel, re-centered. Default camera matches contain_fit; zoom 2 doubles on-screen size on both backends.
fit_view_proj
GPU camera for the shared framing contract: matrix form of world_to_dp over canvas_dp (dp = physical px / density).
fit_view_proj_with_roll
fit_view_proj plus camera roll about the look point. 0.0 matches fit_view_proj.
frame_uv
UV rect for one cell of a sprite-sheet grid: hframes columns by vframes rows, frame counted row-major from the top-left.
host_from_bytes
Host a packed .renb rig. Same rig, a fraction of the bytes: use this for shipped art and keep the .ren as the source of truth.
host_from_str
Host a .ren rig from source text. The game ticks the handle per frame and paints it via actors_view or actors_view_with. Hosts start playing; sim-driven games call pause to hold.
instance_rows
Transform rows mapping quad corners (-0.5..0.5) to world coords, honoring size, rotation, anchor, and mirror. Matches the canvas path pixel-for-pixel at the default anchor: corner (-0.5,-0.5) lands on center - size / 2.
rgba8
screen_camera
Y-down orthographic camera: world (0,0) is the top-left of the viewport, matching canvas orientation by construction. Standalone batches and tests use this directly; viewport snapshots frame through fit_view_proj (contain-fit + look) instead.
sprite_aabb
World-space axis-aligned bounds of a sprite quad.
unproject_px
Unproject one window-physical px point through this frame’s camera.
world_to_dp
World point to dp canvas point through the fit. At the default center (world / 2) this is offset + world * scale.
world_to_dp_with_roll
world_to_dp plus camera roll around cam_center.

Type Aliases§

PlayerHostRef
Shared host handle: the embed owner builds it and passes it to the widget.