repame_view2d/lib.rs
1//! 2D viewport: snapshot in, pixels out.
2//!
3//! The whole 2D screen path of a game lives here, plain sprites included: a
4//! game that draws sprite quads over an atlas needs nothing else, and uses
5//! [`SpriteInstance`] rows through the instanced [`SpriteBatch`], framed by a
6//! dp-space [`Camera2d`] ([`FitMode`]) whose fit law the canvas, the GPU batch
7//! and the CPU picks all read from the same functions ([`effective_fit`],
8//! [`fit_view_proj`], [`world_to_dp`], [`dp_to_world`]).
9//!
10//! Around that core:
11//!
12//! * [`RasterAtlas`] - raster sheets drawn through the same batch, and the
13//! world-anchored [`ActorDrawList`] that puts them, `.ren` vector rigs and
14//! solid rects in one z order.
15//! * [`WorldText`] - world-anchored text floaters, and [`design`] - the design
16//! box onto dp canvas mapping games would otherwise hand-roll.
17//! * [`PickEvent`] - presses, hovers and the slop rule behind a click, plus
18//! [`CursorFrame`]s for a hardware cursor.
19//! * [`fullscreen`] - the fullscreen post pass hook, driven by a WGSL shader
20//! and per-pass uniforms/textures.
21//! * [`actors_view`] - `.ren` rigs played through `renamite-player`, one rig
22//! filling one presented surface.
23//!
24//! Unit discipline lives here, once: games work in world/dp units and do not
25//! touch physical px.
26
27pub mod actors;
28pub use actors::{
29 ActorFit, ActorViewOpts, MINIMAL_REN, actors_view, actors_view_with, host_from_bytes,
30 host_from_str,
31};
32pub use renamite_player::{Player, PlayerError};
33pub use renamite_player_ui::{PlayerHost, PlayerHostRef, ViewTransform};
34
35pub mod batch;
36pub use batch::{
37 AtlasUpload, BatchDesc, BatchFrame, SpriteBatch, TextureFilter, draw_batch, draw_batch_with_id,
38 frame_uv, instance_rows, screen_camera, sprite_aabb,
39};
40
41pub mod camera;
42pub use camera::{
43 Camera2d, FitMode, contain_fit, dp_to_world, dp_to_world_with_roll, effective_fit,
44 fit_view_proj, fit_view_proj_with_roll, unproject_px, world_to_dp, world_to_dp_with_roll,
45};
46
47pub mod cursor;
48pub use cursor::{CursorFrame, cursor_frame};
49
50pub mod design;
51pub use design::{DesignFit, DesignMapping, cover_fit};
52
53pub mod draw;
54pub use draw::{
55 ActorDraw, ActorDrawList, ActorId, ActorItem, ActorLibrary, RasterAtlas, actors_view_mixed,
56 actors_view_mixed_with_events, actors_view_world, actors_view_world_with_events,
57};
58
59pub mod fullscreen;
60pub use fullscreen::{
61 FullscreenDesc, FullscreenPass, FullscreenTexture, FullscreenTextureRef,
62 FullscreenTextureUpload,
63};
64
65pub mod pick;
66pub use pick::{CLICK_SLOP_DP, PickEvent, click_within_slop_dp};
67
68pub mod sprite;
69pub use sprite::{SpriteBlend, SpriteInstance, WorldText, rgba8};