use crate::*;
#[derive(new)]
pub struct CollisionResource {
pub map: CollisionMap,
pub position: Point,
}
impl CollisionResource {
pub fn is_inside(&self, p: &Point) -> bool {
position_inside_rect(
p.x - self.position.x,
p.y - self.position.y,
0,
0,
self.map.size().0,
self.map.size().1,
)
}
pub fn relative_point(&self, p: &Point) -> (u32, u32) {
(
(p.x - self.position.x) as u32,
(p.y - self.position.y) as u32,
)
}
}
#[derive(Clone, Debug, new)]
pub struct RNG {
pub rng: oorandom::Rand32,
}
impl Default for RNG {
fn default() -> Self {
RNG {
rng: oorandom::Rand32::new(1),
}
}
}