radiantkit_core/components/
mod.rs

1pub mod color;
2pub mod selection;
3pub mod transform;
4
5pub use color::*;
6pub use selection::*;
7pub use transform::*;
8
9pub trait RadiantComponent {}
10
11pub trait RadiantSelectable: RadiantComponent {
12    fn set_selected(&mut self, selected: bool);
13}
14
15pub trait RadiantTransformable: RadiantComponent {
16    fn transform_xy(&mut self, position: &[f32; 2]);
17    fn transform_scale(&mut self, scale: &[f32; 2]);
18    fn set_xy(&mut self, position: &[f32; 2]);
19    fn set_scale(&mut self, scale: &[f32; 2]);
20    fn set_rotation(&mut self, rotation: f32);
21    fn get_xy(&self) -> [f32; 2];
22    fn get_scale(&self) -> [f32; 2];
23    fn get_rotation(&self) -> f32;
24}
25
26pub trait RadiantComponentProvider {
27    fn get_component<T: RadiantComponent + 'static>(&self) -> Option<&T>;
28    fn get_component_mut<T: RadiantComponent + 'static>(&mut self) -> Option<&mut T>;
29}