From aa3f8ccaad530ed9af860c10fa4cdaf3d8b1539d Mon Sep 17 00:00:00 2001 From: jacopograndi Date: Mon, 20 Jun 2022 21:57:34 +0200 Subject: colors --- src/main.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index d3d9f70..cdb19d1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -106,9 +106,10 @@ fn setup_map( let downright = Vec3::new(wall[2] as f32, wall[3] as f32, 0.0); let center = (upleft + downright) / 2.0 * 0.002; let size_big = Vec3::new( - (wall[2] - wall[0] +10) as f32, - (wall[3] - wall[1] +10) as f32, 1.0) * 0.002; - spawn_rect(&mut commands, &mut meshes, &mut materials, Color::BLACK, center, size_big); + (wall[2] - wall[0] + 3) as f32, + (wall[3] - wall[1] + 3) as f32, 1.0) * 0.002; + spawn_rect(&mut commands, &mut meshes, &mut materials, + Color::BLACK, center, size_big); } for wall in &map.walls { let upleft = Vec3::new(wall[0] as f32, wall[1] as f32, 0.0); @@ -117,7 +118,14 @@ fn setup_map( let size = Vec3::new( (wall[2] - wall[0]) as f32, (wall[3] - wall[1]) as f32, 1.0) * 0.002; - spawn_rect(&mut commands, &mut meshes, &mut materials, Color::WHITE, center, size); + let color = match wall[4] { + 1 => Color::rgba(0.7, 0.2, 0.0, 1.0), + 2 => Color::rgba(0.15, 0.4, 0.03, 1.0), + 3 => Color::rgba(0.4, 0.4, 0.4, 1.0), + _ => Color::rgba(1.0, 0.4, 0.03, 1.0), + }; + spawn_rect(&mut commands, &mut meshes, &mut materials, + color, center, size); } } -- cgit v1.2.3-54-g00ecf