Browse Source

clean imports

Bastien Sevajol 3 years ago
parent
commit
7523cb0588
4 changed files with 15 additions and 27 deletions
  1. 4 20
      src/main.rs
  2. 2 2
      src/scene/item.rs
  3. 8 4
      src/scene/main.rs
  4. 1 1
      src/ui/mod.rs

+ 4 - 20
src/main.rs View File

1
-use std::cmp;
2
-use std::collections::HashMap;
3
 use std::env;
1
 use std::env;
4
 use std::path;
2
 use std::path;
5
 
3
 
6
-use ggez;
7
-use ggez::{event, input};
8
-use ggez::{Context, GameResult};
9
-use ggez::event::{KeyCode, MouseButton};
10
-use ggez::graphics;
11
-use ggez::graphics::{Color, DrawMode, FillOptions, MeshBuilder, StrokeOptions};
12
-use ggez::timer::check_update_time;
13
-use glam::Vec2;
14
-
15
-use behavior::ItemBehavior;
16
-use physics::{MetaEvent, PhysicEvent, util};
17
-use scene::item::{ItemState, SceneItem, SceneItemSpriteInfo, SceneItemType};
18
 use scene::main::MainState;
4
 use scene::main::MainState;
19
-use scene::SpriteType;
20
-use ui::{SceneItemPrepareOrder, UiItem, UiSpriteInfo, UserEvent};
21
-use ui::scene_item_menu::SceneItemMenuItem;
22
 
5
 
23
-use crate::physics::position::GridPosition;
6
+use ggez::{event, GameResult};
7
+use glam::Vec2;
24
 
8
 
9
+mod behavior;
25
 mod physics;
10
 mod physics;
26
-mod ui;
27
 mod scene;
11
 mod scene;
28
-mod behavior;
12
+mod ui;
29
 
13
 
30
 // TODO: create a ScenePosition and a WindowPosition to be more explicit
14
 // TODO: create a ScenePosition and a WindowPosition to be more explicit
31
 type Point2 = Vec2;
15
 type Point2 = Vec2;

+ 2 - 2
src/scene/item.rs View File

1
 use ggez::graphics;
1
 use ggez::graphics;
2
 
2
 
3
-use crate::{Point2, SCENE_ITEMS_SPRITE_SHEET_HEIGHT, SCENE_ITEMS_SPRITE_SHEET_WIDTH};
4
 use crate::behavior::ItemBehavior;
3
 use crate::behavior::ItemBehavior;
5
-use crate::physics::{MetaEvent, util};
6
 use crate::physics::position::GridPosition;
4
 use crate::physics::position::GridPosition;
5
+use crate::physics::{util, MetaEvent};
7
 use crate::scene::SpriteType;
6
 use crate::scene::SpriteType;
7
+use crate::{Point2, SCENE_ITEMS_SPRITE_SHEET_HEIGHT, SCENE_ITEMS_SPRITE_SHEET_WIDTH};
8
 
8
 
9
 pub struct SceneItemSpriteInfo {
9
 pub struct SceneItemSpriteInfo {
10
     pub relative_start_y: f32,
10
     pub relative_start_y: f32,

+ 8 - 4
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
 
3
 
4
-use ggez::{Context, event, GameResult, graphics, input};
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::timer::check_update_time;
6
 use ggez::timer::check_update_time;
7
+use ggez::{event, graphics, input, Context, GameResult};
8
 
8
 
9
-use crate::{ANIMATE_EACH, DEFAULT_SELECTED_SQUARE_SIDE, DEFAULT_SELECTED_SQUARE_SIDE_HALF, DISPLAY_OFFSET_BY, DISPLAY_OFFSET_BY_SPEED, MAX_FRAME_I, META_EACH, PHYSICS_EACH, Point2, SCENE_ITEMS_CHANGE_ERR_MSG, SPRITE_EACH, TARGET_FPS};
10
 use crate::behavior::ItemBehavior;
9
 use crate::behavior::ItemBehavior;
11
-use crate::physics::{MetaEvent, PhysicEvent, util};
12
 use crate::physics::position::GridPosition;
10
 use crate::physics::position::GridPosition;
11
+use crate::physics::{util, MetaEvent, PhysicEvent};
13
 use crate::scene::item::{ItemState, SceneItem, SceneItemType};
12
 use crate::scene::item::{ItemState, SceneItem, SceneItemType};
14
-use crate::ui::{SceneItemPrepareOrder, UiItem, UiSpriteInfo, UserEvent};
15
 use crate::ui::scene_item_menu::SceneItemMenuItem;
13
 use crate::ui::scene_item_menu::SceneItemMenuItem;
14
+use crate::ui::{SceneItemPrepareOrder, UiItem, UiSpriteInfo, UserEvent};
15
+use crate::{
16
+    Point2, ANIMATE_EACH, DEFAULT_SELECTED_SQUARE_SIDE, DEFAULT_SELECTED_SQUARE_SIDE_HALF,
17
+    DISPLAY_OFFSET_BY, DISPLAY_OFFSET_BY_SPEED, MAX_FRAME_I, META_EACH, PHYSICS_EACH,
18
+    SCENE_ITEMS_CHANGE_ERR_MSG, SPRITE_EACH, TARGET_FPS,
19
+};
16
 use ggez::input::keyboard::KeyCode;
20
 use ggez::input::keyboard::KeyCode;
17
 
21
 
18
 pub struct MainState {
22
 pub struct MainState {

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

1
 use ggez::graphics;
1
 use ggez::graphics;
2
 
2
 
3
-use crate::{Point2, UI_SPRITE_SHEET_HEIGHT, UI_SPRITE_SHEET_WIDTH};
4
 use crate::scene::item::SceneItem;
3
 use crate::scene::item::SceneItem;
5
 use crate::ui::scene_item_menu::SceneItemMenuItem;
4
 use crate::ui::scene_item_menu::SceneItemMenuItem;
5
+use crate::{Point2, UI_SPRITE_SHEET_HEIGHT, UI_SPRITE_SHEET_WIDTH};
6
 
6
 
7
 pub mod scene_item_menu;
7
 pub mod scene_item_menu;
8
 
8