| 
				
			 | 
			
			
				@@ -13,9 +13,9 @@ use crate::behavior::order::Order; 
			 | 
		
	
		
			
			| 
				13
			 | 
			
				13
			 | 
			
			
				 use crate::behavior::ItemBehavior; 
			 | 
		
	
		
			
			| 
				14
			 | 
			
				14
			 | 
			
			
				 use crate::config::{ 
			 | 
		
	
		
			
			| 
				15
			 | 
			
				15
			 | 
			
			
				     ANIMATE_EACH, DEBUG, DEFAULT_SELECTED_SQUARE_SIDE, DEFAULT_SELECTED_SQUARE_SIDE_HALF, 
			 | 
		
	
		
			
			| 
				16
			 | 
			
				
			 | 
			
			
				-    DISPLAY_OFFSET_BY, DISPLAY_OFFSET_BY_SPEED, MAX_FRAME_I, META_EACH, 
			 | 
		
	
		
			
			| 
				17
			 | 
			
				
			 | 
			
			
				-    MOVE_TO_REACHED_WHEN_DISTANCE_INFERIOR_AT, PHYSICS_EACH, SCENE_ITEMS_CHANGE_ERR_MSG, 
			 | 
		
	
		
			
			| 
				18
			 | 
			
				
			 | 
			
			
				-    SPRITE_EACH, TARGET_FPS, 
			 | 
		
	
		
			
			| 
				
			 | 
			
				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, 
			 | 
		
	
		
			
			| 
				
			 | 
			
				18
			 | 
			
			
				+    SCENE_ITEMS_CHANGE_ERR_MSG, SPRITE_EACH, TARGET_FPS, 
			 | 
		
	
		
			
			| 
				19
			 | 
			
				19
			 | 
			
			
				 }; 
			 | 
		
	
		
			
			| 
				20
			 | 
			
				20
			 | 
			
			
				 use crate::physics::util::scene_point_from_window_point; 
			 | 
		
	
		
			
			| 
				21
			 | 
			
				21
			 | 
			
			
				 use crate::physics::util::window_point_from_scene_point; 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -27,6 +27,7 @@ use crate::scene::item::{ 
			 | 
		
	
		
			
			| 
				27
			 | 
			
				27
			 | 
			
			
				 use crate::ui::vertical_menu::{vertical_menu_sprite_info, VerticalMenuSpriteInfo}; 
			 | 
		
	
		
			
			| 
				28
			 | 
			
				28
			 | 
			
			
				 use crate::ui::MenuItem; 
			 | 
		
	
		
			
			| 
				29
			 | 
			
				29
			 | 
			
			
				 use crate::ui::{SceneItemPrepareOrder, UiComponent, UserEvent}; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				30
			 | 
			
			
				+use crate::util::velocity_for_behavior; 
			 | 
		
	
		
			
			| 
				30
			 | 
			
				31
			 | 
			
			
				 use crate::{Offset, ScenePoint, WindowPoint}; 
			 | 
		
	
		
			
			| 
				31
			 | 
			
				32
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				32
			 | 
			
				33
			 | 
			
			
				 pub struct MainState { 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -185,7 +186,8 @@ impl MainState { 
			 | 
		
	
		
			
			| 
				185
			 | 
			
				186
			 | 
			
			
				                 } 
			 | 
		
	
		
			
			| 
				186
			 | 
			
				187
			 | 
			
			
				                 SceneItemPrepareOrder::Hide(scene_item_usize) => { 
			 | 
		
	
		
			
			| 
				187
			 | 
			
				188
			 | 
			
			
				                     let mut scene_item = self.get_scene_item_mut(*scene_item_usize); 
			 | 
		
	
		
			
			| 
				188
			 | 
			
				
			 | 
			
			
				-                    scene_item.next_order = Some(Order::HideTo(scene_click_point));} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				189
			 | 
			
			
				+                    scene_item.next_order = Some(Order::HideTo(scene_click_point)); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				190
			 | 
			
			
				+                } 
			 | 
		
	
		
			
			| 
				189
			 | 
			
				191
			 | 
			
			
				             } 
			 | 
		
	
		
			
			| 
				190
			 | 
			
				192
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				191
			 | 
			
				193
			 | 
			
			
				             self.scene_item_prepare_order = None; 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -255,16 +257,20 @@ impl MainState { 
			 | 
		
	
		
			
			| 
				255
			 | 
			
				257
			 | 
			
			
				         // Scene items movements 
			 | 
		
	
		
			
			| 
				256
			 | 
			
				258
			 | 
			
			
				         for scene_item in self.scene_items.iter_mut() { 
			 | 
		
	
		
			
			| 
				257
			 | 
			
				259
			 | 
			
			
				             match scene_item.state.current_behavior { 
			 | 
		
	
		
			
			| 
				258
			 | 
			
				
			 | 
			
			
				-                ItemBehavior::MoveTo(scene_point) => { 
			 | 
		
	
		
			
			| 
				259
			 | 
			
				
			 | 
			
			
				-                    // FIXME BS NOW: velocity 
			 | 
		
	
		
			
			| 
				260
			 | 
			
				
			 | 
			
			
				-                    let move_vector = (scene_point - scene_item.position).normalize() * 1.0; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				260
			 | 
			
			
				+                ItemBehavior::Standing => {} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				261
			 | 
			
			
				+                ItemBehavior::MoveTo(move_to_scene_point) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				262
			 | 
			
			
				+                | ItemBehavior::MoveFastTo(move_to_scene_point) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				263
			 | 
			
			
				+                | ItemBehavior::HideTo(move_to_scene_point) => { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				264
			 | 
			
			
				+                    let velocity = velocity_for_behavior(&scene_item.state.current_behavior) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				265
			 | 
			
			
				+                        .expect("must have velocity here"); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				266
			 | 
			
			
				+                    let move_vector = 
			 | 
		
	
		
			
			| 
				
			 | 
			
				267
			 | 
			
			
				+                        (move_to_scene_point - scene_item.position).normalize() * velocity; 
			 | 
		
	
		
			
			| 
				261
			 | 
			
				268
			 | 
			
			
				                     // TODO ici il faut calculer le déplacement réél (en fonction des ticks, etc ...) 
			 | 
		
	
		
			
			| 
				262
			 | 
			
				269
			 | 
			
			
				                     scene_item.position.x += move_vector.x; 
			 | 
		
	
		
			
			| 
				263
			 | 
			
				270
			 | 
			
			
				                     scene_item.position.y += move_vector.y; 
			 | 
		
	
		
			
			| 
				264
			 | 
			
				271
			 | 
			
			
				                     scene_item.grid_position = 
			 | 
		
	
		
			
			| 
				265
			 | 
			
				272
			 | 
			
			
				                         util::grid_position_from_scene_point(&scene_item.position); 
			 | 
		
	
		
			
			| 
				266
			 | 
			
				273
			 | 
			
			
				                 } 
			 | 
		
	
		
			
			| 
				267
			 | 
			
				
			 | 
			
			
				-                _ => {} 
			 | 
		
	
		
			
			| 
				268
			 | 
			
				274
			 | 
			
			
				             } 
			 | 
		
	
		
			
			| 
				269
			 | 
			
				275
			 | 
			
			
				         } 
			 | 
		
	
		
			
			| 
				270
			 | 
			
				276
			 | 
			
			
				  
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -463,7 +469,15 @@ impl MainState { 
			 | 
		
	
		
			
			| 
				463
			 | 
			
				469
			 | 
			
			
				     ) -> GameResult<MeshBuilder> { 
			 | 
		
	
		
			
			| 
				464
			 | 
			
				470
			 | 
			
			
				         if let Some(scene_item_prepare_order) = &self.scene_item_prepare_order { 
			 | 
		
	
		
			
			| 
				465
			 | 
			
				471
			 | 
			
			
				             match scene_item_prepare_order { 
			 | 
		
	
		
			
			| 
				466
			 | 
			
				
			 | 
			
			
				-                SceneItemPrepareOrder::Move(scene_item_usize) => { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				472
			 | 
			
			
				+                SceneItemPrepareOrder::Move(scene_item_usize) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				473
			 | 
			
			
				+                | SceneItemPrepareOrder::MoveFast(scene_item_usize) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				474
			 | 
			
			
				+                | SceneItemPrepareOrder::Hide(scene_item_usize) => { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				475
			 | 
			
			
				+                    let color = match &scene_item_prepare_order { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				476
			 | 
			
			
				+                        SceneItemPrepareOrder::Move(_) => graphics::BLUE, 
			 | 
		
	
		
			
			| 
				
			 | 
			
				477
			 | 
			
			
				+                        SceneItemPrepareOrder::MoveFast(_) => graphics::MAGENTA, 
			 | 
		
	
		
			
			| 
				
			 | 
			
				478
			 | 
			
			
				+                        SceneItemPrepareOrder::Hide(_) => graphics::YELLOW, 
			 | 
		
	
		
			
			| 
				
			 | 
			
				479
			 | 
			
			
				+                    }; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				480
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				467
			 | 
			
				481
			 | 
			
			
				                     let scene_item = self.get_scene_item(*scene_item_usize); 
			 | 
		
	
		
			
			| 
				468
			 | 
			
				482
			 | 
			
			
				                     mesh_builder.line( 
			 | 
		
	
		
			
			| 
				469
			 | 
			
				483
			 | 
			
			
				                         &vec![ 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -474,7 +488,7 @@ impl MainState { 
			 | 
		
	
		
			
			| 
				474
			 | 
			
				488
			 | 
			
			
				                             ), 
			 | 
		
	
		
			
			| 
				475
			 | 
			
				489
			 | 
			
			
				                         ], 
			 | 
		
	
		
			
			| 
				476
			 | 
			
				490
			 | 
			
			
				                         2.0, 
			 | 
		
	
		
			
			| 
				477
			 | 
			
				
			 | 
			
			
				-                        graphics::WHITE, 
			 | 
		
	
		
			
			| 
				
			 | 
			
				491
			 | 
			
			
				+                        color, 
			 | 
		
	
		
			
			| 
				478
			 | 
			
				492
			 | 
			
			
				                     )?; 
			 | 
		
	
		
			
			| 
				479
			 | 
			
				493
			 | 
			
			
				                 } 
			 | 
		
	
		
			
			| 
				480
			 | 
			
				494
			 | 
			
			
				             } 
			 |