diff --git a/code/rust-sokoban-c01-03/src/main.rs b/code/rust-sokoban-c01-03/src/main.rs index 4773641..68c1530 100644 --- a/code/rust-sokoban-c01-03/src/main.rs +++ b/code/rust-sokoban-c01-03/src/main.rs @@ -1,11 +1,11 @@ -use ggez; -use ggez::graphics; -use ggez::graphics::DrawParam; -use ggez::graphics::Image; +// Rust sokoban +// main.rs + + + use ggez::{conf, event, Context, GameResult}; -use specs::{ - join::Join, Builder, Component, ReadStorage, RunNow, System, VecStorage, World, WorldExt, -}; +use specs::{Builder, Component, VecStorage, World, WorldExt}; + use std::path; @@ -52,7 +52,7 @@ impl event::EventHandler for Game { Ok(()) } - fn draw(&mut self, context: &mut Context) -> GameResult { + fn draw(&mut self, _context: &mut Context) -> GameResult { Ok(()) } } diff --git a/code/rust-sokoban-c01-04/src/main.rs b/code/rust-sokoban-c01-04/src/main.rs index 1fc48a3..7f82725 100644 --- a/code/rust-sokoban-c01-04/src/main.rs +++ b/code/rust-sokoban-c01-04/src/main.rs @@ -1,9 +1,9 @@ -use ggez; -use ggez::graphics; -use ggez::graphics::DrawParam; -use ggez::graphics::Image; +// Rust sokoban +// main.rs + use glam::Vec2; -use ggez::{conf, event, Context, GameResult}; +use ggez::{conf, event, Context, GameResult, + graphics::{self, DrawParam, Image}}; use specs::{ join::Join, Builder, Component, ReadStorage, RunNow, System, VecStorage, World, WorldExt, }; diff --git a/code/rust-sokoban-c02-01/src/main.rs b/code/rust-sokoban-c02-01/src/main.rs index c0ede9e..561e0f2 100644 --- a/code/rust-sokoban-c02-01/src/main.rs +++ b/code/rust-sokoban-c02-01/src/main.rs @@ -1,9 +1,9 @@ -use ggez; -use ggez::graphics; -use ggez::graphics::DrawParam; -use ggez::graphics::Image; +// Rust sokoban +// main.rs + use glam::Vec2; -use ggez::{conf, event, Context, GameResult}; +use ggez::{conf, event, Context, GameResult, + graphics::{self, DrawParam, Image}}; use specs::{ join::Join, Builder, Component, ReadStorage, RunNow, System, VecStorage, World, WorldExt, }; diff --git a/code/rust-sokoban-c02-02/src/main.rs b/code/rust-sokoban-c02-02/src/main.rs index 0f3b792..cf0dd0e 100644 --- a/code/rust-sokoban-c02-02/src/main.rs +++ b/code/rust-sokoban-c02-02/src/main.rs @@ -1,12 +1,12 @@ -use ggez; -use ggez::event::{KeyCode, KeyMods}; -use ggez::graphics; -use ggez::graphics::DrawParam; -use ggez::graphics::Image; +// Rust sokoban +// main.rs + use glam::Vec2; -use ggez::{conf, event, Context, GameResult}; +use ggez::{conf, Context, GameResult, + event::{self, KeyCode, KeyMods}, + graphics::{self, DrawParam, Image}}; use specs::{ - join::Join, Builder, Component, Read, ReadStorage, RunNow, System, VecStorage, World, WorldExt, + join::Join, Builder, Component, ReadStorage, RunNow, System, VecStorage, World, WorldExt, Write, WriteStorage, }; diff --git a/code/rust-sokoban-c02-03/src/main.rs b/code/rust-sokoban-c02-03/src/main.rs index 3823466..fda8fd8 100644 --- a/code/rust-sokoban-c02-03/src/main.rs +++ b/code/rust-sokoban-c02-03/src/main.rs @@ -1,19 +1,19 @@ -use ggez; -use ggez::event::KeyCode; -use ggez::event::KeyMods; -use ggez::graphics; -use ggez::graphics::DrawParam; -use ggez::graphics::Image; +// Rust sokoban +// main.rs + + + use glam::Vec2; -use ggez::{conf, event, Context, GameResult}; -use specs::world::Index; -use specs::Entities; -use specs::NullStorage; -use specs::WriteStorage; +use ggez::{ + conf, Context, GameResult, + event::{self, KeyCode, KeyMods}, + graphics::{self, DrawParam, Image}}; use specs::{ - join::Join, Builder, Component, Read, ReadStorage, RunNow, System, VecStorage, World, WorldExt, - Write, + join::Join, Builder, Component, ReadStorage, RunNow, + System, VecStorage, World, WorldExt, + Write, WriteStorage, NullStorage, Entities, world::Index }; + use std::collections::HashMap; use std::path; @@ -129,11 +129,11 @@ impl<'a> System<'a> for InputSystem { // Get the first key pressed if let Some(key) = input_queue.keys_pressed.pop() { // get all the movables and immovables - let mut mov: HashMap<(u8, u8), Index> = (&entities, &movables, &positions) + let mov: HashMap<(u8, u8), Index> = (&entities, &movables, &positions) .join() .map(|t| ((t.2.x, t.2.y), t.0.id())) .collect::>(); - let mut immov: HashMap<(u8, u8), Index> = (&entities, &immovables, &positions) + let immov: HashMap<(u8, u8), Index> = (&entities, &immovables, &positions) .join() .map(|t| ((t.2.x, t.2.y), t.0.id())) .collect::>(); @@ -171,7 +171,7 @@ impl<'a> System<'a> for InputSystem { // if it exists, we need to stop and not move anything // if it doesn't exist, we stop because we found a gap match immov.get(&pos) { - Some(id) => to_move.clear(), + Some(_id) => to_move.clear(), None => break, } } diff --git a/code/rust-sokoban-c02-04/src/main.rs b/code/rust-sokoban-c02-04/src/main.rs index dbd784d..34f10b7 100644 --- a/code/rust-sokoban-c02-04/src/main.rs +++ b/code/rust-sokoban-c02-04/src/main.rs @@ -1,7 +1,7 @@ -use ggez; -use ggez::event::KeyCode; -use ggez::event::KeyMods; -use ggez::{conf, event, Context, GameResult}; +// Rust sokoban +// main.rs + +use ggez::{conf, event::{self, KeyCode, KeyMods}, Context, GameResult}; use specs::{RunNow, World, WorldExt}; use std::path; diff --git a/code/rust-sokoban-c02-05/src/main.rs b/code/rust-sokoban-c02-05/src/main.rs index c692e20..327da35 100644 --- a/code/rust-sokoban-c02-05/src/main.rs +++ b/code/rust-sokoban-c02-05/src/main.rs @@ -1,7 +1,7 @@ -use ggez; -use ggez::event::KeyCode; -use ggez::event::KeyMods; -use ggez::{conf, event, Context, GameResult}; +// Rust sokoban +// main.rs + +use ggez::{conf, event::{self, KeyCode, KeyMods}, Context, GameResult}; use specs::{RunNow, World, WorldExt}; use std::path; diff --git a/code/rust-sokoban-c03-01/src/main.rs b/code/rust-sokoban-c03-01/src/main.rs index 30ed508..8336960 100644 --- a/code/rust-sokoban-c03-01/src/main.rs +++ b/code/rust-sokoban-c03-01/src/main.rs @@ -1,7 +1,7 @@ -use ggez; -use ggez::event::KeyCode; -use ggez::event::KeyMods; -use ggez::{conf, event, Context, GameResult}; +// Rust sokoban +// main.rs + +use ggez::{conf, event::{self, KeyCode, KeyMods}, Context, GameResult}; use specs::{RunNow, World, WorldExt}; use std::path; diff --git a/code/rust-sokoban-c03-02/src/main.rs b/code/rust-sokoban-c03-02/src/main.rs index af664ad..6fda229 100644 --- a/code/rust-sokoban-c03-02/src/main.rs +++ b/code/rust-sokoban-c03-02/src/main.rs @@ -1,8 +1,8 @@ -use ggez; -use ggez::event::KeyCode; -use ggez::event::KeyMods; -use ggez::{conf, event, timer, Context, GameResult}; +// Rust sokoban +// main.rs +use ggez::{conf, event::{self, KeyCode, KeyMods}, timer, Context, GameResult}; use specs::{RunNow, World, WorldExt}; + use std::path; mod components; diff --git a/code/rust-sokoban-c03-03/src/main.rs b/code/rust-sokoban-c03-03/src/main.rs index bbd40c3..47b6b8f 100644 --- a/code/rust-sokoban-c03-03/src/main.rs +++ b/code/rust-sokoban-c03-03/src/main.rs @@ -1,8 +1,8 @@ -use ggez; -use ggez::event::KeyCode; -use ggez::event::KeyMods; -use ggez::{conf, event, timer, Context, GameResult}; +// Rust sokoban +// main.rs +use ggez::{conf, event::{self, KeyCode, KeyMods}, timer, Context, GameResult}; use specs::{RunNow, World, WorldExt}; + use std::path; mod audio; diff --git a/code/rust-sokoban-c03-04/src/main.rs b/code/rust-sokoban-c03-04/src/main.rs index bbd40c3..47b6b8f 100644 --- a/code/rust-sokoban-c03-04/src/main.rs +++ b/code/rust-sokoban-c03-04/src/main.rs @@ -1,8 +1,8 @@ -use ggez; -use ggez::event::KeyCode; -use ggez::event::KeyMods; -use ggez::{conf, event, timer, Context, GameResult}; +// Rust sokoban +// main.rs +use ggez::{conf, event::{self, KeyCode, KeyMods}, timer, Context, GameResult}; use specs::{RunNow, World, WorldExt}; + use std::path; mod audio; diff --git a/code/rust-sokoban-c03-05/src/main.rs b/code/rust-sokoban-c03-05/src/main.rs index bbd40c3..47b6b8f 100644 --- a/code/rust-sokoban-c03-05/src/main.rs +++ b/code/rust-sokoban-c03-05/src/main.rs @@ -1,8 +1,8 @@ -use ggez; -use ggez::event::KeyCode; -use ggez::event::KeyMods; -use ggez::{conf, event, timer, Context, GameResult}; +// Rust sokoban +// main.rs +use ggez::{conf, event::{self, KeyCode, KeyMods}, timer, Context, GameResult}; use specs::{RunNow, World, WorldExt}; + use std::path; mod audio; diff --git a/code/rust-sokoban-c04-01/src/main.rs b/code/rust-sokoban-c04-01/src/main.rs index bbd40c3..47b6b8f 100644 --- a/code/rust-sokoban-c04-01/src/main.rs +++ b/code/rust-sokoban-c04-01/src/main.rs @@ -1,8 +1,8 @@ -use ggez; -use ggez::event::KeyCode; -use ggez::event::KeyMods; -use ggez::{conf, event, timer, Context, GameResult}; +// Rust sokoban +// main.rs +use ggez::{conf, event::{self, KeyCode, KeyMods}, timer, Context, GameResult}; use specs::{RunNow, World, WorldExt}; + use std::path; mod audio;