Skip to main content

Crate repame_view2d

Crate repame_view2d 

Source
Expand description

2D viewport: snapshot in, pixels out.

The whole 2D screen path of a game lives here, plain sprites included: a game that draws sprite quads over an atlas needs nothing else, and uses SpriteInstance rows through the instanced SpriteBatch, framed by a dp-space Camera2d (FitMode) whose fit law the canvas, the GPU batch and the CPU picks all read from the same functions (effective_fit, fit_view_proj, world_to_dp, dp_to_world).

Around that core:

  • RasterAtlas - raster sheets drawn through the same batch, and the world-anchored ActorDrawList that puts them, .ren vector rigs and solid rects in one z order.
  • WorldText - world-anchored text floaters, and design - the design box onto dp canvas mapping games would otherwise hand-roll.
  • PickEvent - presses, hovers and the slop rule behind a click, plus CursorFrames for a hardware cursor.
  • fullscreen - the fullscreen post pass hook, driven by a WGSL shader and per-pass uniforms/textures.
  • actors_view - .ren rigs played through renamite-player, one rig filling one presented surface.

Unit discipline lives here, once: games work in world/dp units and do not touch physical px.

Re-exports§

pub use actors::ActorFit;
pub use actors::ActorViewOpts;
pub use actors::MINIMAL_REN;
pub use actors::actors_view;
pub use actors::actors_view_with;
pub use actors::host_from_bytes;
pub use actors::host_from_str;
pub use batch::AtlasUpload;
pub use batch::BatchDesc;
pub use batch::BatchFrame;
pub use batch::SpriteBatch;
pub use batch::TextureFilter;
pub use batch::draw_batch;
pub use batch::draw_batch_with_id;
pub use batch::frame_uv;
pub use batch::instance_rows;
pub use batch::screen_camera;
pub use batch::sprite_aabb;
pub use camera::Camera2d;
pub use camera::FitMode;
pub use camera::contain_fit;
pub use camera::dp_to_world;
pub use camera::dp_to_world_with_roll;
pub use camera::effective_fit;
pub use camera::fit_view_proj;
pub use camera::fit_view_proj_with_roll;
pub use camera::unproject_px;
pub use camera::world_to_dp;
pub use camera::world_to_dp_with_roll;
pub use cursor::CursorFrame;
pub use cursor::cursor_frame;
pub use design::DesignFit;
pub use design::DesignMapping;
pub use design::cover_fit;
pub use draw::ActorDraw;
pub use draw::ActorDrawList;
pub use draw::ActorId;
pub use draw::ActorItem;
pub use draw::ActorLibrary;
pub use draw::RasterAtlas;
pub use draw::actors_view_mixed;
pub use draw::actors_view_mixed_with_events;
pub use draw::actors_view_world;
pub use draw::actors_view_world_with_events;
pub use fullscreen::FullscreenDesc;
pub use fullscreen::FullscreenPass;
pub use fullscreen::FullscreenTexture;
pub use fullscreen::FullscreenTextureRef;
pub use fullscreen::FullscreenTextureUpload;
pub use pick::CLICK_SLOP_DP;
pub use pick::PickEvent;
pub use pick::click_within_slop_dp;
pub use sprite::SpriteBlend;
pub use sprite::SpriteInstance;
pub use sprite::WorldText;
pub use sprite::rgba8;

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§

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.
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.

Enums§

PlayerError

Type Aliases§

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