1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
use bevy::prelude::Color;
#[derive(Copy, Clone)]
pub struct ColliderDebugRender {
pub color: Color,
}
pub const DEFAULT_COLOR: Color = Color::BEIGE;
pub const DEFAULT_PALETTE: [Color; 3] = [
Color::rgb(
0x98 as f32 / 255.0,
0xC1 as f32 / 255.0,
0xD9 as f32 / 255.0,
),
Color::rgb(
0x05 as f32 / 255.0,
0x3C as f32 / 255.0,
0x5E as f32 / 255.0,
),
Color::rgb(
0x1F as f32 / 255.0,
0x7A as f32 / 255.0,
0x8C as f32 / 255.0,
),
];
impl Default for ColliderDebugRender {
fn default() -> Self {
DEFAULT_COLOR.into()
}
}
impl From<Color> for ColliderDebugRender {
fn from(color: Color) -> Self {
ColliderDebugRender { color }
}
}
impl ColliderDebugRender {
pub fn with_id(i: usize) -> Self {
DEFAULT_PALETTE[i % DEFAULT_PALETTE.len()].into()
}
}