mirror of
https://github.com/Noratrieb/game-wip-dontplay.git
synced 2026-01-16 04:25:00 +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,
|
input::Input,
|
||||||
math::{center_offset, TILE_SIZE},
|
math::{center_offset, TILE_SIZE},
|
||||||
res::Res,
|
res::Res,
|
||||||
world::{TPosSc, CHUNK_EXTENT},
|
world::{ChkPosSc, TPosSc, CHUNK_EXTENT, REGION_CHUNK_EXTENT},
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Application level state (includes game and ui state, etc.)
|
/// Application level state (includes game and ui state, etc.)
|
||||||
|
|
@ -215,10 +215,13 @@ impl App {
|
||||||
mouse_tpos.y,
|
mouse_tpos.y,
|
||||||
self.game.world.tile_at_mut(mouse_tpos, &self.game.worldgen)
|
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!(
|
imm!(
|
||||||
"@ chunk {}, {}",
|
"@ region {}, {}",
|
||||||
mouse_tpos.x / CHUNK_EXTENT as TPosSc,
|
m_chk_x / REGION_CHUNK_EXTENT as ChkPosSc,
|
||||||
mouse_tpos.y / CHUNK_EXTENT as TPosSc
|
m_chk_y / REGION_CHUNK_EXTENT as ChkPosSc
|
||||||
);
|
);
|
||||||
if self.debug.freecam && self.input.pressed(Key::P) {
|
if self.debug.freecam && self.input.pressed(Key::P) {
|
||||||
self.game.world.player.col_en.en.pos.x = wpos.x as i32;
|
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 EMPTY: TileId = 0;
|
||||||
pub const UNBREAKANIUM: TileId = 5;
|
pub const UNBREAKANIUM: TileId = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub const REGION_CHUNK_EXTENT: u8 = 8;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue