diff options
Diffstat (limited to 'pixel-client')
| -rw-r--r-- | pixel-client/src/game.rs | 6 | ||||
| -rw-r--r-- | pixel-client/src/main.rs | 8 | ||||
| -rw-r--r-- | pixel-client/src/menu.rs | 10 | ||||
| -rw-r--r-- | pixel-client/src/render/mod.rs | 2 | ||||
| -rw-r--r-- | pixel-client/src/render/sprite.rs | 2 | ||||
| -rw-r--r-- | pixel-client/src/tilemap.rs | 2 | ||||
| -rw-r--r-- | pixel-client/tools/src/bin/bunnymark.rs | 2 | 
7 files changed, 18 insertions, 14 deletions
| diff --git a/pixel-client/src/game.rs b/pixel-client/src/game.rs index 57f419e2..aefafd6e 100644 --- a/pixel-client/src/game.rs +++ b/pixel-client/src/game.rs @@ -169,13 +169,13 @@ impl Game {              self.camera_center.exp_to(player.movement.position, dt * 5.);          } -        for (_pid, player) in &mut self.players { +        for player in self.players.values_mut() {              if let Some(item) = &mut player.item {                  item.parent_position = player.movement.position;                  item.tick(1., dt);              }          } -        for (_pos, tile) in &mut self.tiles { +        for tile in self.tiles.values_mut() {              if let Some(item) = &mut tile.item {                  item.tick(1., dt)              } @@ -359,8 +359,6 @@ impl Game {          self.tilemap.draw(ctx); -         -          if let Some(me) = self.players.get(&self.my_id) {              let t = me.movement.get_interact_target();              ctx.draw_world( diff --git a/pixel-client/src/main.rs b/pixel-client/src/main.rs index 7501aba2..65de7b15 100644 --- a/pixel-client/src/main.rs +++ b/pixel-client/src/main.rs @@ -52,7 +52,7 @@ pub enum Action {  }  enum State { -    Ingame(Game), +    Ingame(Box<Game>),      Menu(Menu),  } @@ -89,10 +89,10 @@ fn main() {      let mut state = match args.action.unwrap_or_default() {          Action::Menu => State::Menu(Menu::new()), -        Action::Join { server_address } => State::Ingame(Game::new( +        Action::Join { server_address } => State::Ingame(Box::new(Game::new(              Network::connect(&server_address).unwrap(), -            &renderer.atlas_layout(), -        )), +            renderer.atlas_layout(), +        ))),      };      let mut events = sdl_context.event_pump().unwrap(); diff --git a/pixel-client/src/menu.rs b/pixel-client/src/menu.rs index 0a05e84c..a3242edb 100644 --- a/pixel-client/src/menu.rs +++ b/pixel-client/src/menu.rs @@ -3,10 +3,16 @@ use sdl2::keyboard::KeyboardState;  pub struct Menu {} +impl Default for Menu { +    fn default() -> Self { +        Self::new() +    } +} +  impl Menu {      pub fn new() -> Self {          Self {}      } -    pub fn tick(&mut self, dt: f32, keyboard: &KeyboardState, layout: &AtlasLayout) {} -    pub fn draw(&self, ctx: &mut SpriteRenderer) {} +    pub fn tick(&mut self, _dt: f32, _keyboard: &KeyboardState, _layout: &AtlasLayout) {} +    pub fn draw(&self, _ctx: &mut SpriteRenderer) {}  } diff --git a/pixel-client/src/render/mod.rs b/pixel-client/src/render/mod.rs index f18d96ad..4eea439a 100644 --- a/pixel-client/src/render/mod.rs +++ b/pixel-client/src/render/mod.rs @@ -71,7 +71,7 @@ impl<'a> SpriteRenderer<'a> {              }              for (x, char) in line.chars().enumerate() {                  let color = palette.get(&char).unwrap(); -                texels[(y * 1024 + x) * 4 + 0] = color[3]; +                texels[(y * 1024 + x) * 4] = color[3];                  texels[(y * 1024 + x) * 4 + 1] = color[2];                  texels[(y * 1024 + x) * 4 + 2] = color[1];                  texels[(y * 1024 + x) * 4 + 3] = color[0]; diff --git a/pixel-client/src/render/sprite.rs b/pixel-client/src/render/sprite.rs index 4210b58d..084e277e 100644 --- a/pixel-client/src/render/sprite.rs +++ b/pixel-client/src/render/sprite.rs @@ -92,7 +92,7 @@ impl Ord for SpriteDraw {  }  impl PartialOrd for SpriteDraw {      fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> { -        Some(self.cmp(&other)) +        Some(self.cmp(other))      }  }  impl Eq for SpriteDraw {} diff --git a/pixel-client/src/tilemap.rs b/pixel-client/src/tilemap.rs index 768f79ba..05f33b4b 100644 --- a/pixel-client/src/tilemap.rs +++ b/pixel-client/src/tilemap.rs @@ -99,7 +99,7 @@ impl Tilemap {          if let Some(gid) = self.connect_group_by_tile[tile.0] {              let cgroup = &self.connect_members_by_group[gid];              idx |= 0b0100 * (cgroup.contains(&neighbors[0])) as usize; -            idx |= 0b0001 * (cgroup.contains(&neighbors[1])) as usize; +            idx |= (cgroup.contains(&neighbors[1])) as usize;              idx |= 0b1000 * (cgroup.contains(&neighbors[2])) as usize;              idx |= 0b0010 * (cgroup.contains(&neighbors[3])) as usize;          } diff --git a/pixel-client/tools/src/bin/bunnymark.rs b/pixel-client/tools/src/bin/bunnymark.rs index f59fecff..b9e4b0ae 100644 --- a/pixel-client/tools/src/bin/bunnymark.rs +++ b/pixel-client/tools/src/bin/bunnymark.rs @@ -28,7 +28,7 @@ const WIDTH: i32 = 1920;  const HEIGHT: i32 = 1080;  pub fn main() { -    let amount = std::env::args().skip(1).next().unwrap().parse().unwrap(); +    let amount = std::env::args().nth(1).unwrap().parse().unwrap();      let sdl_context = sdl2::init().unwrap();      let video_subsystem = sdl_context.video().unwrap(); | 
