Pārlūkot izejas kodu

resolve some warnings

Bastien Sevajol 3 gadus atpakaļ
vecāks
revīzija
3300d1950e
5 mainītis faili ar 9 papildinājumiem un 25 dzēšanām
  1. 0 1
      src/main.rs
  2. 2 2
      src/map/mod.rs
  3. 1 7
      src/physics/util.rs
  4. 5 10
      src/scene/main.rs
  5. 1 5
      src/ui/mod.rs

+ 0 - 1
src/main.rs Parādīt failu

@@ -17,7 +17,6 @@ mod util;
17 17
 type WindowPoint = Vec2;
18 18
 type Offset = Vec2;
19 19
 type ScenePoint = Vec2;
20
-type Vector2 = Vec2;
21 20
 
22 21
 pub fn main() -> GameResult {
23 22
     let resource_dir = if let Ok(manifest_dir) = env::var("CARGO_MANIFEST_DIR") {

+ 2 - 2
src/map/mod.rs Parādīt failu

@@ -8,8 +8,8 @@ use std::fs::File;
8 8
 use std::io::BufReader;
9 9
 use std::path::Path;
10 10
 use tiled::{
11
-    parse_with_path, Image as TiledImage, Image, Layer, LayerData, Map as TiledMap, Orientation,
12
-    PropertyValue, Tile as TiledTile, TiledError, Tileset,
11
+    parse_with_path, Image as TiledImage, Layer, LayerData, Map as TiledMap, Orientation,
12
+    PropertyValue, Tileset,
13 13
 };
14 14
 
15 15
 fn get_tile_from_terrain_tileset_with_id(

+ 1 - 7
src/physics/util.rs Parādīt failu

@@ -1,12 +1,6 @@
1 1
 use crate::config::{GRID_TILE_HEIGHT, GRID_TILE_WIDTH};
2 2
 use crate::physics::GridPosition;
3
-use crate::{ScenePoint, Vector2, WindowPoint};
4
-
5
-pub fn vec_from_angle(angle: f32) -> Vector2 {
6
-    let vx = angle.sin();
7
-    let vy = angle.cos();
8
-    Vector2::new(vx, vy)
9
-}
3
+use crate::{ScenePoint, WindowPoint};
10 4
 
11 5
 pub fn grid_position_from_scene_point(position: &ScenePoint) -> GridPosition {
12 6
     GridPosition::new(

+ 5 - 10
src/scene/main.rs Parādīt failu

@@ -1,10 +1,9 @@
1 1
 use std::cmp;
2 2
 use std::collections::HashMap;
3
-use std::f32::consts::FRAC_PI_2;
4 3
 
5 4
 use ggez::event::MouseButton;
6 5
 use ggez::graphics::{DrawMode, MeshBuilder, StrokeOptions};
7
-use ggez::input::keyboard::{pressed_keys, KeyCode};
6
+use ggez::input::keyboard::KeyCode;
8 7
 use ggez::timer::check_update_time;
9 8
 use ggez::{event, graphics, input, Context, GameResult};
10 9
 
@@ -13,8 +12,7 @@ use crate::behavior::order::Order;
13 12
 use crate::behavior::ItemBehavior;
14 13
 use crate::config::{
15 14
     ANIMATE_EACH, DEFAULT_SELECTED_SQUARE_SIDE, DEFAULT_SELECTED_SQUARE_SIDE_HALF,
16
-    DISPLAY_OFFSET_BY, DISPLAY_OFFSET_BY_SPEED, MAX_FRAME_I, META_EACH, MOVE_FAST_VELOCITY,
17
-    MOVE_HIDE_VELOCITY, MOVE_TO_REACHED_WHEN_DISTANCE_INFERIOR_AT, MOVE_VELOCITY, PHYSICS_EACH,
15
+    DISPLAY_OFFSET_BY, DISPLAY_OFFSET_BY_SPEED, MAX_FRAME_I, META_EACH, PHYSICS_EACH,
18 16
     SCENE_ITEMS_CHANGE_ERR_MSG, SPRITE_EACH, TARGET_FPS,
19 17
 };
20 18
 use crate::map::Map;
@@ -22,15 +20,12 @@ use crate::physics::util::scene_point_from_window_point;
22 20
 use crate::physics::util::window_point_from_scene_point;
23 21
 use crate::physics::GridPosition;
24 22
 use crate::physics::{util, MetaEvent, PhysicEvent};
25
-use crate::scene::item::{
26
-    apply_scene_item_modifier, ItemState, SceneItem, SceneItemModifier, SceneItemType,
27
-};
28
-use crate::ui::vertical_menu::{vertical_menu_sprite_info, VerticalMenuSpriteInfo};
23
+use crate::scene::item::{apply_scene_item_modifier, ItemState, SceneItem, SceneItemType};
24
+use crate::ui::vertical_menu::vertical_menu_sprite_info;
29 25
 use crate::ui::MenuItem;
30 26
 use crate::ui::{SceneItemPrepareOrder, UiComponent, UserEvent};
31 27
 use crate::util::velocity_for_behavior;
32 28
 use crate::{Offset, ScenePoint, WindowPoint};
33
-use std::fs::File;
34 29
 use std::path::Path;
35 30
 use std::time::Instant;
36 31
 
@@ -375,7 +370,7 @@ impl MainState {
375 370
     }
376 371
 
377 372
     fn animate(&mut self) {
378
-        for (i, scene_item) in self.scene_items.iter_mut().enumerate() {
373
+        for (_, scene_item) in self.scene_items.iter_mut().enumerate() {
379 374
             apply_scene_item_modifier(scene_item, digest_next_order(&scene_item));
380 375
             apply_scene_item_modifier(scene_item, digest_current_order(&scene_item));
381 376
             apply_scene_item_modifier(scene_item, digest_current_behavior(&scene_item));

+ 1 - 5
src/ui/mod.rs Parādīt failu

@@ -1,8 +1,4 @@
1
-use ggez::graphics;
2
-
3
-use crate::config::{UI_SPRITE_SHEET_HEIGHT, UI_SPRITE_SHEET_WIDTH};
4
-use crate::scene::item::SceneItem;
5
-use crate::{Offset, ScenePoint, WindowPoint};
1
+use crate::WindowPoint;
6 2
 
7 3
 pub mod vertical_menu;
8 4