summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorArne Dußin2021-05-05 23:40:17 +0200
committerArne Dußin2021-05-05 23:40:17 +0200
commitf3178df0a92fb3b87087e78cad7b9313f947be6a (patch)
treea201943ce821f18bbb4e9bba393c87155d68a61a /src/main.rs
downloadpmd_coop-f3178df0a92fb3b87087e78cad7b9313f947be6a.tar.gz
pmd_coop-f3178df0a92fb3b87087e78cad7b9313f947be6a.zip
Initial commit
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
new file mode 100644
index 0000000..60186b3
--- /dev/null
+++ b/src/main.rs
@@ -0,0 +1,45 @@
+pub mod components;
+pub mod systems;
+pub mod texture_manager;
+
+use components::{Pos, StaticDrawable};
+use specs::prelude::*;
+use specs::{DispatcherBuilder, World};
+use systems::{SysDraw, SysInput};
+
+fn main()
+{
+ let sdl = sdl2::init().expect("Unable to start SDL context");
+ let video_subsys = sdl.video().expect("Unable to get SDL Video context");
+
+ let window = video_subsys
+ .window("Pokemon Mystery Dungeon coop clone", 800, 600)
+ .position_centered()
+ .opengl()
+ .resizable()
+ .build()
+ .expect("Unable to create window");
+
+ let mut world = World::new();
+ world.register::<Pos>();
+ world.register::<StaticDrawable>();
+
+ world
+ .create_entity()
+ .with(Pos { x: 0., y: 0. })
+ .with(StaticDrawable {
+ texture_name: "portraits.png".to_string(),
+ })
+ .build();
+
+ let sys_input = SysInput::new(&sdl);
+ let sys_draw = SysDraw::new(window);
+ let mut dispatcher = DispatcherBuilder::new()
+ .with_thread_local(sys_input)
+ .with_thread_local(sys_draw)
+ .build();
+
+ loop {
+ dispatcher.dispatch(&mut world);
+ }
+}