mirror of
https://github.com/Noratrieb/game-wip-dontplay.git
synced 2026-01-16 04:25:00 +01:00
Render some tiles
This commit is contained in:
parent
7a3018c2b1
commit
5e539d668f
5 changed files with 115 additions and 10 deletions
14
src/math.rs
14
src/math.rs
|
|
@ -1,6 +1,20 @@
|
|||
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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue