tmp_stationary_obstacles.rs 525 Bytes
Newer Older
Grisu's avatar
Grisu committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::colors;
use crate::components;
use crate::resources;

#[legion::system(for_each)]
pub fn draw_tmp_stationary_obstacles(
    obstacle: &components::Obstacle,
    pos: &components::Position,
    #[resource] rendering: &mut resources::Rendering,
) {
    rendering.begin_path();
    rendering.set_fill_style(&colors::PRIMARY3_SHADE3);
    let w = obstacle.width() as f64;
    let h = obstacle.height() as f64;

    rendering.fill_rect(pos.0.x as f64 - w / 2.0, pos.0.y as f64 - h / 2.0, w, h);
    rendering.fill();
}