2023-01-05 20:01:11 +00:00
|
|
|
use std::fmt;
|
|
|
|
|
2023-01-04 13:37:25 +00:00
|
|
|
|
|
|
|
pub type EntityId = u32;
|
|
|
|
|
|
|
|
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
|
|
|
|
pub struct Location {
|
|
|
|
pub x: i32,
|
|
|
|
pub y: i32,
|
2022-12-31 14:22:44 +00:00
|
|
|
}
|
|
|
|
|
2023-01-04 13:37:25 +00:00
|
|
|
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
|
|
|
|
pub struct Entity {
|
|
|
|
pub id: EntityId,
|
|
|
|
pub loc: Location
|
2023-01-05 20:01:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
impl fmt::Display for Location {
|
|
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
|
|
write!(f, "({}, {})", self.x, self.y)
|
|
|
|
}
|
2023-01-04 13:37:25 +00:00
|
|
|
}
|