render_agnostic/
lib.rs

1use anchor2d::Anchor2D;
2use glam::DVec2;
3use palette::Srgba;
4
5pub mod renderers;
6
7pub trait Renderer {
8    type Font;
9
10    fn render_line(&mut self, start: DVec2, end: DVec2, thickness: f64, color: Srgba);
11    fn render_circle(&mut self, position: DVec2, radius: f64, color: Srgba);
12    fn render_circle_lines(&mut self, position: DVec2, radius: f64, thickness: f64, color: Srgba);
13
14    fn render_arc(
15        &mut self,
16        position: DVec2,
17        radius: f64,
18        rotation: f64,
19        arc: f64,
20        thickness: f64,
21        color: Srgba,
22    );
23
24    fn render_text(
25        &mut self,
26        text: &str,
27        position: DVec2,
28        anchor: Anchor2D,
29        size: f64,
30        color: Srgba,
31        font: Self::Font,
32    );
33
34    fn render_rectangle(
35        &mut self,
36        position: DVec2,
37        width: f64,
38        height: f64,
39        offset: DVec2,
40        rotation: f64,
41        color: Srgba,
42    );
43
44    fn render_rectangle_lines(
45        &mut self,
46        position: DVec2,
47        width: f64,
48        height: f64,
49        offset: DVec2,
50        rotation: f64,
51        thickness: f64,
52        color: Srgba,
53    );
54
55    fn render_equilateral_triangle(
56        &mut self,
57        position: DVec2,
58        radius: f64,
59        rotation: f64,
60        color: Srgba,
61    );
62
63    fn render_equilateral_triangle_lines(
64        &mut self,
65        position: DVec2,
66        radius: f64,
67        rotation: f64,
68        thickness: f64,
69        color: Srgba,
70    );
71}