mirror of
https://github.com/Noratrieb/game-wip-dontplay.git
synced 2026-01-14 19:55:02 +01:00
Define region chunk extent
This commit is contained in:
parent
7c3bfe373a
commit
aed3e86a17
2 changed files with 9 additions and 4 deletions
11
src/app.rs
11
src/app.rs
|
|
@ -18,7 +18,7 @@ use crate::{
|
|||
input::Input,
|
||||
math::{center_offset, TILE_SIZE},
|
||||
res::Res,
|
||||
world::{TPosSc, CHUNK_EXTENT},
|
||||
world::{ChkPosSc, TPosSc, CHUNK_EXTENT, REGION_CHUNK_EXTENT},
|
||||
};
|
||||
|
||||
/// Application level state (includes game and ui state, etc.)
|
||||
|
|
@ -215,10 +215,13 @@ impl App {
|
|||
mouse_tpos.y,
|
||||
self.game.world.tile_at_mut(mouse_tpos, &self.game.worldgen)
|
||||
);
|
||||
let m_chk_x = (mouse_tpos.x / CHUNK_EXTENT as TPosSc) as ChkPosSc;
|
||||
let m_chk_y = (mouse_tpos.y / CHUNK_EXTENT as TPosSc) as ChkPosSc;
|
||||
imm!("@ chunk {m_chk_x}, {m_chk_y}");
|
||||
imm!(
|
||||
"@ chunk {}, {}",
|
||||
mouse_tpos.x / CHUNK_EXTENT as TPosSc,
|
||||
mouse_tpos.y / CHUNK_EXTENT as TPosSc
|
||||
"@ region {}, {}",
|
||||
m_chk_x / REGION_CHUNK_EXTENT as ChkPosSc,
|
||||
m_chk_y / REGION_CHUNK_EXTENT as ChkPosSc
|
||||
);
|
||||
if self.debug.freecam && self.input.pressed(Key::P) {
|
||||
self.game.world.player.col_en.en.pos.x = wpos.x as i32;
|
||||
|
|
|
|||
|
|
@ -166,3 +166,5 @@ impl Tile {
|
|||
pub const EMPTY: TileId = 0;
|
||||
pub const UNBREAKANIUM: TileId = 5;
|
||||
}
|
||||
|
||||
pub const REGION_CHUNK_EXTENT: u8 = 8;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue