mirror of
https://github.com/Noratrieb/game-wip-dontplay.git
synced 2026-01-16 20:35:02 +01:00
First phase of serialization
This commit is contained in:
parent
aed3e86a17
commit
6896698883
7 changed files with 152 additions and 15 deletions
14
src/app.rs
14
src/app.rs
|
|
@ -18,7 +18,6 @@ use crate::{
|
|||
input::Input,
|
||||
math::{center_offset, TILE_SIZE},
|
||||
res::Res,
|
||||
world::{ChkPosSc, TPosSc, CHUNK_EXTENT, REGION_CHUNK_EXTENT},
|
||||
};
|
||||
|
||||
/// Application level state (includes game and ui state, etc.)
|
||||
|
|
@ -74,6 +73,7 @@ impl App {
|
|||
gamedebug_core::inc_frame();
|
||||
}
|
||||
self.game.tile_db.try_save();
|
||||
self.game.world.save();
|
||||
}
|
||||
|
||||
fn do_event_handling(&mut self) {
|
||||
|
|
@ -215,14 +215,10 @@ 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!(
|
||||
"@ region {}, {}",
|
||||
m_chk_x / REGION_CHUNK_EXTENT as ChkPosSc,
|
||||
m_chk_y / REGION_CHUNK_EXTENT as ChkPosSc
|
||||
);
|
||||
let m_chk = mouse_tpos.to_chunk();
|
||||
imm!("@ chunk {}, {}", m_chk.x, m_chk.y);
|
||||
let (m_chk_x, m_chk_y) = m_chk.region();
|
||||
imm!("@ region {m_chk_x}, {m_chk_y}");
|
||||
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.y = wpos.y as i32;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue