diff --git a/crates/comet_ecs/src/component.rs b/crates/comet_ecs/src/component.rs index c98d172..1e4d604 100755 --- a/crates/comet_ecs/src/component.rs +++ b/crates/comet_ecs/src/component.rs @@ -227,8 +227,11 @@ impl Position3D { } impl Rectangle2D { - pub fn new(position: Position2D, size: v2) -> Self { - Self { position, size } + pub fn with_size(width: f32, height: f32) -> Self { + Self { + position: Position2D::from_vec(v2::new(0.0, 0.0)), + size: v2::new(width, height), + } } pub fn position(&self) -> Position2D { @@ -262,6 +265,16 @@ impl Collider for Rectangle2D { } } +impl Render2D { + pub fn with_texture(texture: &'static str) -> Self { + Self { + is_visible: true, + texture_name: texture, + scale: v2::new(1.0, 1.0), + } + } +} + impl Render for Render2D { fn is_visible(&self) -> bool { self.is_visible