deathframe 0.1.2

My game development framework for the amethyst game engine
use crate::geo::Rect;

use super::component_prelude::*;

/// Entities' `Transform`s are _confined_ to an area with this component.
/// Their `Transform` may never leave this confined area.
pub struct Confined {
    pub rect: Rect,
}

impl Confined {
    pub fn new(rect: Rect) -> Self {
        Self { rect }
    }
}

impl Component for Confined {
    type Storage = VecStorage<Self>;
}

impl From<Rect> for Confined {
    fn from(rect: Rect) -> Self {
        Self { rect }
    }
}

impl From<&Rect> for Confined {
    fn from(rect: &Rect) -> Self {
        Self { rect: rect.clone() }
    }
}