render_agnostic/
lib.rs

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