Skip to main content

shuyi_ui/
grid.rs

1//! The tactics kit's map (game ADR-0038, game ADR-0088): a screen says *what*
2//! is on the visible part of a grid map as a [`MapScene`] (plain data),
3//! and a [`GridSkin`] says how it looks. The skin paints the ground (each
4//! tile's terrain, flashing where it just changed), the ranges by their
5//! names, the path, the cursor and the threat arrows; the units are the
6//! game's own view of them, painted by the game's [`UnitPainter`] between
7//! the skin's layers.
8//!
9//! Two skins: the [`GlyphSkin`] draws each tile as two glyph cells, in
10//! its own look or another [`GlyphStyle`] (a one-bit screen's), and the
11//! [`SpriteSkin`] paints the ground from a tileset's terrain tiles, with
12//! layers between tiles by the corner rule ([`corners`]) and the map's
13//! light, at any of the zooms it offers. Both lay their tiles out top-down
14//! ([`Projection`]). How a game with painters of its own and several looks
15//! uses them, with no skin trait of its own: [`skin`]'s docs.
16//!
17//! With them, the rest of a grid stage's look: the tile [`Camera`], the
18//! virtual [`Cursor`], a path that follows it ([`steer()`]) and how long a
19//! unit's walk is shown ([`walk`]); and a whole map painted once to pan
20//! over ([`MapPicture`]). Anything new shown on a map goes in the scene
21//! and is painted by every skin; it is never drawn straight into the
22//! buffer by a screen.
23//!
24//! The debug view's `grid` channel shows a scene's layout over it: the
25//! cell lines, the map's bounds, the cursor's cell and each unit's
26//! ([`debug::layout_gizmos`], ADR-0085).
27
28pub mod camera;
29pub mod corners;
30pub mod cursor;
31pub mod debug;
32pub mod glyph;
33pub mod layout;
34pub mod path;
35pub mod picture;
36pub mod scene;
37pub mod skin;
38pub mod sprite;
39pub mod steer;
40#[cfg(test)]
41pub(crate) mod testing;
42pub mod threat;
43pub mod walk;
44
45pub use camera::Camera;
46pub use cursor::Cursor;
47pub use glyph::{GlyphSkin, GlyphStyle};
48pub use layout::{CELL_PX, Grid, Projection, px_rect};
49pub use picture::MapPicture;
50pub use scene::{
51    CursorStyle, CursorView, Ends, MapEdges, MapScene, MapUnit, RangeLayer, RangeName, ThreatView,
52    TileView, Tints,
53};
54pub use skin::{
55    GridSkin, Looks, MapColors, NoUnits, TerrainGlyphs, Terrains, UnitPainter, WalkSpeeds,
56};
57pub use sprite::SpriteSkin;
58pub use steer::steer;
59pub use walk::{Facing, Gait, STANDING_FRAME};