render_agnostic/
lib.rs

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