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_text_outline(
41        &mut self,
42        text: &str,
43        position: DVec2,
44        anchor: Anchor2D,
45        size: f64,
46        outline_thickness: f64,
47        color: Srgba,
48        outline_color: Srgba,
49    );
50
51    fn render_rectangle(
52        &mut self,
53        position: DVec2,
54        width: f64,
55        height: f64,
56        offset: DVec2,
57        rotation: f64,
58        color: Srgba,
59    );
60
61    fn render_rectangle_lines(
62        &mut self,
63        position: DVec2,
64        width: f64,
65        height: f64,
66        offset: DVec2,
67        rotation: f64,
68        thickness: f64,
69        color: Srgba,
70    );
71
72    fn render_equilateral_triangle(
73        &mut self,
74        position: DVec2,
75        radius: f64,
76        rotation: f64,
77        color: Srgba,
78    );
79
80    fn render_equilateral_triangle_lines(
81        &mut self,
82        position: DVec2,
83        radius: f64,
84        rotation: f64,
85        thickness: f64,
86        color: Srgba,
87    );
88}