Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make imports all one line #99

Merged
merged 2 commits into from
Nov 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions code/rust-sokoban-c01-03/src/main.rs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down Expand Up @@ -52,7 +52,7 @@ impl event::EventHandler<ggez::GameError> for Game {
Ok(())
}

fn draw(&mut self, context: &mut Context) -> GameResult {
fn draw(&mut self, _context: &mut Context) -> GameResult {
Ok(())
}
}
Expand Down
10 changes: 5 additions & 5 deletions code/rust-sokoban-c01-04/src/main.rs
Original file line number Diff line number Diff line change
@@ -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,
};
Expand Down
10 changes: 5 additions & 5 deletions code/rust-sokoban-c02-01/src/main.rs
Original file line number Diff line number Diff line change
@@ -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,
};
Expand Down
14 changes: 7 additions & 7 deletions code/rust-sokoban-c02-02/src/main.rs
Original file line number Diff line number Diff line change
@@ -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,
};

Expand Down
32 changes: 16 additions & 16 deletions code/rust-sokoban-c02-03/src/main.rs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down Expand Up @@ -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::<HashMap<_, _>>();
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::<HashMap<_, _>>();
Expand Down Expand Up @@ -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,
}
}
Expand Down
8 changes: 4 additions & 4 deletions code/rust-sokoban-c02-04/src/main.rs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
4 changes: 2 additions & 2 deletions code/rust-sokoban-c02-04/src/systems/input_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use crate::components::*;
use crate::constants::*;
use crate::resources::InputQueue;
use ggez::event::KeyCode;
use specs::world::Index;
use specs::{Entities, Join, ReadStorage, System, Write, WriteStorage};
use specs::{world::Index, Entities, Join, ReadStorage, System, Write, WriteStorage};

use std::collections::HashMap;

pub struct InputSystem {}
Expand Down
10 changes: 5 additions & 5 deletions code/rust-sokoban-c02-04/src/systems/rendering_system.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@


use crate::components::*;
use crate::constants::TILE_WIDTH;
use ggez::graphics;
use ggez::graphics::DrawParam;
use ggez::graphics::Image;
use glam::Vec2;
use ggez::Context;

use ggez::{Context, graphics::{self, DrawParam, Image}};
use specs::{Join, ReadStorage, System};
use glam::Vec2;

pub struct RenderingSystem<'a> {
pub context: &'a mut Context,
Expand Down
8 changes: 4 additions & 4 deletions code/rust-sokoban-c02-05/src/main.rs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
4 changes: 2 additions & 2 deletions code/rust-sokoban-c02-05/src/resources.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use ggez::event::KeyCode;
use specs::World;
use std::fmt;
use std::fmt::Display;

use std::fmt::{self, Display};

// Resources
#[derive(Default)]
Expand Down
4 changes: 2 additions & 2 deletions code/rust-sokoban-c02-05/src/systems/input_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use crate::components::*;
use crate::constants::*;
use crate::resources::{InputQueue, Gameplay};
use ggez::event::KeyCode;
use specs::world::Index;
use specs::{Entities, Join, ReadStorage, System, Write, WriteStorage};
use specs::{world::Index, Entities, Join, ReadStorage, System, Write, WriteStorage};

use std::collections::HashMap;

pub struct InputSystem {}
Expand Down
12 changes: 6 additions & 6 deletions code/rust-sokoban-c02-05/src/systems/rendering_system.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@



use crate::components::*;
use crate::resources::*;
use crate::constants::TILE_WIDTH;
use ggez::graphics;
use ggez::graphics::DrawParam;
use ggez::graphics::Image;
use ggez::graphics::Color;
use glam::Vec2;
use ggez::Context;

use ggez::{Context, graphics::{self, DrawParam, Image, Color}};
use specs::{Join, ReadStorage, System, Read};
use glam::Vec2;

pub struct RenderingSystem<'a> {
pub context: &'a mut Context,
Expand Down
4 changes: 2 additions & 2 deletions code/rust-sokoban-c03-01/src/components.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use specs::{Component, NullStorage, VecStorage, World, WorldExt};
use std::fmt;
use std::fmt::Display;

use std::fmt::{self, Display};

// Components
#[derive(Debug, Component, Clone, Copy)]
Expand Down
8 changes: 4 additions & 4 deletions code/rust-sokoban-c03-01/src/main.rs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
4 changes: 2 additions & 2 deletions code/rust-sokoban-c03-01/src/resources.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use ggez::event::KeyCode;
use specs::World;
use std::fmt;
use std::fmt::Display;

use std::fmt::{self, Display};

// Resources
#[derive(Default)]
Expand Down
4 changes: 2 additions & 2 deletions code/rust-sokoban-c03-01/src/systems/input_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use crate::components::*;
use crate::constants::*;
use crate::resources::{InputQueue, Gameplay};
use ggez::event::KeyCode;
use specs::world::Index;
use specs::{Entities, Join, ReadStorage, System, Write, WriteStorage};
use specs::{world::Index, Entities, Join, ReadStorage, System, Write, WriteStorage};

use std::collections::HashMap;

pub struct InputSystem {}
Expand Down
12 changes: 6 additions & 6 deletions code/rust-sokoban-c03-01/src/systems/rendering_system.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@



use crate::components::*;
use crate::resources::*;
use crate::constants::TILE_WIDTH;
use ggez::graphics;
use ggez::graphics::DrawParam;
use ggez::graphics::Image;
use ggez::graphics::Color;
use glam::Vec2;
use ggez::Context;

use ggez::{Context, graphics::{self, DrawParam, Image, Color}};
use specs::{Join, ReadStorage, System, Read};
use glam::Vec2;

pub struct RenderingSystem<'a> {
pub context: &'a mut Context,
Expand Down
4 changes: 2 additions & 2 deletions code/rust-sokoban-c03-02/src/components.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use specs::{Component, NullStorage, VecStorage, World, WorldExt};
use std::fmt;
use std::fmt::Display;

use std::fmt::{self, Display};

// Components
#[derive(Debug, Component, Clone, Copy)]
Expand Down
8 changes: 4 additions & 4 deletions code/rust-sokoban-c03-02/src/main.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
4 changes: 2 additions & 2 deletions code/rust-sokoban-c03-02/src/resources.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use ggez::event::KeyCode;
use specs::World;
use std::fmt;
use std::{fmt::Display, time::Duration};

use std::{fmt::{self, Display}, time::Duration};

// Resources
#[derive(Default)]
Expand Down
4 changes: 2 additions & 2 deletions code/rust-sokoban-c03-02/src/systems/input_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use crate::components::*;
use crate::constants::*;
use crate::resources::{InputQueue, Gameplay};
use ggez::event::KeyCode;
use specs::world::Index;
use specs::{Entities, Join, ReadStorage, System, Write, WriteStorage};
use specs::{world::Index, Entities, Join, ReadStorage, System, Write, WriteStorage};

use std::collections::HashMap;

pub struct InputSystem {}
Expand Down
14 changes: 7 additions & 7 deletions code/rust-sokoban-c03-02/src/systems/rendering_system.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@

use crate::components::*;
use crate::constants::TILE_WIDTH;
use crate::resources::*;
use ggez::graphics;
use ggez::graphics::Color;
use ggez::graphics::DrawParam;
use ggez::graphics::Image;
use crate::constants::TILE_WIDTH;

use ggez::{Context, graphics::{self, DrawParam, Image, Color}};
use specs::{Join, ReadStorage, System, Read};
use glam::Vec2;
use ggez::Context;
use specs::{Join, Read, ReadStorage, System};


use std::time::Duration;

pub struct RenderingSystem<'a> {
Expand Down
4 changes: 2 additions & 2 deletions code/rust-sokoban-c03-03/src/components.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use specs::{Component, NullStorage, VecStorage, World, WorldExt};
use std::fmt;
use std::fmt::Display;

use std::fmt::{self, Display};

// Components
#[derive(Debug, Component, Clone, Copy)]
Expand Down
8 changes: 4 additions & 4 deletions code/rust-sokoban-c03-03/src/main.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
4 changes: 2 additions & 2 deletions code/rust-sokoban-c03-03/src/resources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use crate::audio::AudioStore;
use crate::events::Event;
use ggez::event::KeyCode;
use specs::World;
use std::fmt;
use std::{fmt::Display, time::Duration};

use std::{fmt::{self, Display}, time::Duration};

// Resources
#[derive(Default)]
Expand Down
4 changes: 2 additions & 2 deletions code/rust-sokoban-c03-03/src/systems/input_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use crate::constants::*;
use crate::events::{EntityMoved, Event};
use crate::resources::{EventQueue, Gameplay, InputQueue};
use ggez::event::KeyCode;
use specs::world::Index;
use specs::{Entities, Join, ReadStorage, System, Write, WriteStorage};
use specs::{world::Index, Entities, Join, ReadStorage, System, Write, WriteStorage};

use std::collections::HashMap;

pub struct InputSystem {}
Expand Down
Loading