diff options
| author | Arne Dußin | 2021-05-07 18:06:02 +0200 |
|---|---|---|
| committer | Arne Dußin | 2021-05-07 18:06:02 +0200 |
| commit | 6de8cfc84edbc80196ad144f2886031a898f5ed7 (patch) | |
| tree | b51d5f147dacce69bbb70bf363067a2528a2601f /src/main.rs | |
| parent | f3178df0a92fb3b87087e78cad7b9313f947be6a (diff) | |
| download | pmd_coop-main.tar.gz pmd_coop-main.zip | |
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/main.rs b/src/main.rs index 60186b3..8bc4faf 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,11 +1,16 @@ +#![allow(dead_code)] + pub mod components; +pub mod math; pub mod systems; pub mod texture_manager; -use components::{Pos, StaticDrawable}; +use components::*; +use math::Vec2; +use sdl2::rect::Rect; use specs::prelude::*; use specs::{DispatcherBuilder, World}; -use systems::{SysDraw, SysInput}; +use systems::{SysDraw, SysInput, SysMovement}; fn main() { @@ -23,23 +28,30 @@ fn main() let mut world = World::new(); world.register::<Pos>(); world.register::<StaticDrawable>(); + world.register::<Velocity>(); + world.register::<Player>(); world .create_entity() - .with(Pos { x: 0., y: 0. }) + .with(Pos(Vec2::new(0., 0.))) + .with(Velocity(Vec2::new(0., 0.))) .with(StaticDrawable { texture_name: "portraits.png".to_string(), + source_rect: Rect::new(0, 0, 40, 40), }) + .with(Player) .build(); let sys_input = SysInput::new(&sdl); let sys_draw = SysDraw::new(window); + let sys_move = SysMovement::new(); let mut dispatcher = DispatcherBuilder::new() + .with(sys_move, "move", &[]) .with_thread_local(sys_input) .with_thread_local(sys_draw) .build(); loop { - dispatcher.dispatch(&mut world); + dispatcher.dispatch(&world); } } |
