mirror of
https://github.com/Noratrieb/game-wip-dontplay.git
synced 2026-01-14 19:55:02 +01:00
20 lines
369 B
Rust
20 lines
369 B
Rust
use crate::world::TilePos;
|
|
|
|
pub type WorldPosScalar = i32;
|
|
|
|
#[derive(Clone, Copy)]
|
|
pub struct WorldPos {
|
|
pub x: WorldPosScalar,
|
|
pub y: WorldPosScalar,
|
|
}
|
|
|
|
impl WorldPos {
|
|
pub fn tile_pos(&self) -> TilePos {
|
|
TilePos {
|
|
x: self.x / TILE_SIZE as i32,
|
|
y: self.y / TILE_SIZE as i32,
|
|
}
|
|
}
|
|
}
|
|
|
|
pub const TILE_SIZE: u8 = 32;
|