diff options
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/main.rs b/src/main.rs index 586b456..bc616ca 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,8 +4,6 @@ mod renderer; mod sim; use futures::executor; -use fxhash::FxHashMap; -use glam::Vec2; use rand::random_range; use std::{collections::VecDeque, sync::Arc, time::Instant}; use winit::{ @@ -21,12 +19,12 @@ use winit::{ use crate::{ camera::Camera, - config::{CHUNK_SIZE, PHYSICS_DELTA_TIME, PHYSICS_FPS, SIM_FPS, WINDOW_TITLE}, + config::{PHYSICS_DELTA_TIME, PHYSICS_FPS, SIM_FPS, WINDOW_TITLE}, renderer::RendererState, sim::{ cell::{cell::Cell, materials::MaterialId}, cell_sim::{sim::sim_tick, world::World}, - rb_sim::{DebugRenderMode, RbSimManager}, + rb_sim::{DebugRenderMode, RbSimManager, debug_ops::DebugOperator}, write_rb_entity_to_world, }, }; @@ -115,11 +113,11 @@ impl App { } if self.input.trigger_test_2 - && let Some((cx, cy)) = self.input.last_mouse_chunk_pos - && let Some(world) = &self.world + && let Some(lm) = self.input.last_mouse_world_pos && let Some(rbsm) = &mut self.rb_sim_manager { self.input.trigger_test_2 = false; + rbsm.test_spawn_ball(lm.0, lm.1, self.config.dropper_material); } // --TEST DRAWING-- @@ -182,10 +180,15 @@ impl App { for (lx, ly, x, y) in cells_written { // update the entity // TODO we should skip cells that weren't changed? + // TODO optimize let new_local_cell = world.get_cell_from_game_position(x, y).unwrap(); - // if new_local_cell.material != MaterialId::Void && !new_local_cell.rb() { - // panic!("Someone swapped into this rb's cell!"); - // } + if new_local_cell.material != MaterialId::Void && !new_local_cell.rb() { + panic!( + "Someone swapped into this rb's cell! ({x}, {y}, {m:#?}, {f})", + m = new_local_cell.material, + f = new_local_cell.flags + ); + } rb_entity.set_cell_at_local_position(lx, ly, new_local_cell); // update the world world.set_cell_from_game_position(x, y, Cell::void(), false); @@ -261,7 +264,7 @@ impl Default for App { use_threading: true, brush_radius: 10.0, brush_material: MaterialId::Sand, - dropper_material: MaterialId::Sand, + dropper_material: MaterialId::Wood, debug_render: true, debug_render_mode: DebugRenderMode::default(), }, @@ -283,9 +286,6 @@ impl ApplicationHandler for App { self.window = Some(window.clone()); self.renderer_state = Some(executor::block_on(RendererState::new(window.clone()))); - if let Some(rbsm) = &mut self.rb_sim_manager { - rbsm.test(); - } let size = window.inner_size(); self.camera = Some(Camera::new((size.width as i32, size.height as i32))); |
