Browse Source

resolve some warnings

Bastien Sevajol 3 years ago
parent
commit
3300d1950e
5 changed files with 9 additions and 25 deletions
  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 View File

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

+ 2 - 2
src/map/mod.rs View File

8
 use std::io::BufReader;
8
 use std::io::BufReader;
9
 use std::path::Path;
9
 use std::path::Path;
10
 use tiled::{
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
 fn get_tile_from_terrain_tileset_with_id(
15
 fn get_tile_from_terrain_tileset_with_id(

+ 1 - 7
src/physics/util.rs View File

1
 use crate::config::{GRID_TILE_HEIGHT, GRID_TILE_WIDTH};
1
 use crate::config::{GRID_TILE_HEIGHT, GRID_TILE_WIDTH};
2
 use crate::physics::GridPosition;
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
 pub fn grid_position_from_scene_point(position: &ScenePoint) -> GridPosition {
5
 pub fn grid_position_from_scene_point(position: &ScenePoint) -> GridPosition {
12
     GridPosition::new(
6
     GridPosition::new(

+ 5 - 10
src/scene/main.rs View File

1
 use std::cmp;
1
 use std::cmp;
2
 use std::collections::HashMap;
2
 use std::collections::HashMap;
3
-use std::f32::consts::FRAC_PI_2;
4
 
3
 
5
 use ggez::event::MouseButton;
4
 use ggez::event::MouseButton;
6
 use ggez::graphics::{DrawMode, MeshBuilder, StrokeOptions};
5
 use ggez::graphics::{DrawMode, MeshBuilder, StrokeOptions};
7
-use ggez::input::keyboard::{pressed_keys, KeyCode};
6
+use ggez::input::keyboard::KeyCode;
8
 use ggez::timer::check_update_time;
7
 use ggez::timer::check_update_time;
9
 use ggez::{event, graphics, input, Context, GameResult};
8
 use ggez::{event, graphics, input, Context, GameResult};
10
 
9
 
13
 use crate::behavior::ItemBehavior;
12
 use crate::behavior::ItemBehavior;
14
 use crate::config::{
13
 use crate::config::{
15
     ANIMATE_EACH, DEFAULT_SELECTED_SQUARE_SIDE, DEFAULT_SELECTED_SQUARE_SIDE_HALF,
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
     SCENE_ITEMS_CHANGE_ERR_MSG, SPRITE_EACH, TARGET_FPS,
16
     SCENE_ITEMS_CHANGE_ERR_MSG, SPRITE_EACH, TARGET_FPS,
19
 };
17
 };
20
 use crate::map::Map;
18
 use crate::map::Map;
22
 use crate::physics::util::window_point_from_scene_point;
20
 use crate::physics::util::window_point_from_scene_point;
23
 use crate::physics::GridPosition;
21
 use crate::physics::GridPosition;
24
 use crate::physics::{util, MetaEvent, PhysicEvent};
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
 use crate::ui::MenuItem;
25
 use crate::ui::MenuItem;
30
 use crate::ui::{SceneItemPrepareOrder, UiComponent, UserEvent};
26
 use crate::ui::{SceneItemPrepareOrder, UiComponent, UserEvent};
31
 use crate::util::velocity_for_behavior;
27
 use crate::util::velocity_for_behavior;
32
 use crate::{Offset, ScenePoint, WindowPoint};
28
 use crate::{Offset, ScenePoint, WindowPoint};
33
-use std::fs::File;
34
 use std::path::Path;
29
 use std::path::Path;
35
 use std::time::Instant;
30
 use std::time::Instant;
36
 
31
 
375
     }
370
     }
376
 
371
 
377
     fn animate(&mut self) {
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
             apply_scene_item_modifier(scene_item, digest_next_order(&scene_item));
374
             apply_scene_item_modifier(scene_item, digest_next_order(&scene_item));
380
             apply_scene_item_modifier(scene_item, digest_current_order(&scene_item));
375
             apply_scene_item_modifier(scene_item, digest_current_order(&scene_item));
381
             apply_scene_item_modifier(scene_item, digest_current_behavior(&scene_item));
376
             apply_scene_item_modifier(scene_item, digest_current_behavior(&scene_item));

+ 1 - 5
src/ui/mod.rs View File

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
 pub mod vertical_menu;
3
 pub mod vertical_menu;
8
 
4