pub fn write_debug_map<L: Layer + Serialize, T: Serialize + Clone>(
map: &CellMap<L, T>,
name: &str,
)Expand description
Writes the given map to the given location, prepending “debug” to the name.
Examples found in repository?
examples/map_rotations_check.rs (line 43)
15fn main() {
16 let translated = CellMap::<Layers, f64>::new(CellMapParams {
17 cell_size: Vector2::new(1.0, 1.0),
18 cell_bounds: Bounds::new((0, 10), (0, 10)).unwrap(),
19 position_in_parent: Vector2::new(5.0, 5.0),
20 ..Default::default()
21 });
22
23 let rotated = CellMap::<Layers, f64>::new(CellMapParams {
24 cell_bounds: Bounds::new((0, 10), (0, 10)).unwrap(),
25 cell_size: Vector2::new(1.0, 1.0),
26 position_in_parent: Vector2::new(5.0, 5.0),
27 rotation_in_parent_rad: std::f64::consts::FRAC_PI_4,
28 ..Default::default()
29 });
30
31 let scaled = CellMap::<Layers, f64>::new(CellMapParams {
32 cell_bounds: Bounds::new((0, 10), (0, 10)).unwrap(),
33 cell_size: Vector2::new(0.5, 0.5),
34 position_in_parent: Vector2::new(5.0, 5.0),
35 rotation_in_parent_rad: std::f64::consts::FRAC_PI_4,
36 ..Default::default()
37 });
38
39 #[cfg(all(feature = "debug_maps"))]
40 {
41 use cell_map::write_debug_map;
42
43 write_debug_map(&translated, "translated");
44 write_debug_map(&rotated, "rotated");
45 write_debug_map(&scaled, "scaled");
46 }
47}