use number_traits::Float;
use mat32;

use specs::{VecStorage, Component};


pub struct Transform2D<T: 'static + Sync + Send + Copy + Float>(pub [T; 6]);


impl<T: 'static + Sync + Send + Copy + Float> Component for Transform2D<T> {
    type Storage = VecStorage<Self>;
}

impl<T: 'static + Sync + Send + Copy + Float> From<[T; 6]> for Transform2D<T> {

    #[inline(always)]
    fn from(matrix: [T; 6]) -> Self {
        Transform2D(matrix)
    }
}

impl<T: 'static + Sync + Send + Copy + Float> Default for Transform2D<T> {

    #[inline(always)]
    fn default() -> Self {
        Self::from(mat32::new_identity())
    }
}

impl<T: 'static + Sync + Send + Copy + Float> Transform2D<T> {

    #[inline(always)]
    pub fn new() -> Self {
        Self::default()
    }
}
