Commit 145b72fa authored by Rahix's avatar Rahix 🦀
Browse files

ingame: Integrate collider world again

parent e5f7c627
use crate::colliders;
use crate::colors;
use crate::resources;
use crate::state;
......@@ -15,19 +16,25 @@ pub struct InGameState {
impl InGameState {
pub fn new(level: svg_loader::SvgLevel) -> InGameState {
let mut rendering = resources::Rendering::new("game-canvas").unwrap();
let foreground = rendering.register_image(level.foreground_image);
let background = rendering.register_image(level.background_image);
let foreground = rendering.register_image(level.foreground_image.clone());
let background = rendering.register_image(level.background_image.clone());
let mut resources = legion::Resources::default();
resources.insert(resources::Clock::new());
resources.insert(rendering);
resources.insert(resources::Camera::new(1920.0, 1080.0));
resources.insert(colliders::CollisionWorld::new());
let world = legion::World::default();
let mut world = legion::World::default();
level.apply_colliders(&mut world);
let schedule = legion::Schedule::builder()
.add_system(colliders::synchronize_collisision_world_system())
.flush()
.add_system(systems::moving_system())
.add_thread_local(systems::camera_system())
.add_system(colliders::update_collision_world_system())
.flush()
.add_thread_local(systems::draw_level_layer_system(background))
.add_thread_local(systems::draw_level_layer_system(foreground))
.build();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment