Browse Source

start order move code

Bastien Sevajol 3 years ago
parent
commit
c9a65474ac
1 changed files with 12 additions and 4 deletions
  1. 12 4
      src/scene/main.rs

+ 12 - 4
src/scene/main.rs View File

149
 
149
 
150
         if let Some(scene_item_prepare_order) = &self.scene_item_prepare_order {
150
         if let Some(scene_item_prepare_order) = &self.scene_item_prepare_order {
151
             // TODO: Add order to scene_item
151
             // TODO: Add order to scene_item
152
+            match scene_item_prepare_order {
153
+                SceneItemPrepareOrder::Move(scene_item_usize) => {
154
+                    let scene_item = self.scene_items.get_mut(*scene_item_usize).expect(SCENE_ITEMS_CHANGE_ERR_MSG);
155
+                    let angle = f32::atan2(scene_position.y - scene_item.position.y, scene_position.x - scene_item.position.x) + f32::consts::FRAC_PI_2;
156
+                    println!("{:?}", angle);
157
+                }
158
+            }
159
+
152
             self.scene_item_prepare_order = None;
160
             self.scene_item_prepare_order = None;
153
         }
161
         }
154
 
162
 
521
         graphics::clear(ctx, graphics::BLACK);
529
         graphics::clear(ctx, graphics::BLACK);
522
         let mut scene_mesh_builder = MeshBuilder::new();
530
         let mut scene_mesh_builder = MeshBuilder::new();
523
 
531
 
524
-        self.generate_scene_item_sprites();
525
-        self.generate_scene_item_menu_sprites();
526
-        self.generate_map_sprites();
532
+        self.generate_scene_item_sprites()?;
533
+        self.generate_scene_item_menu_sprites()?;
534
+        self.generate_map_sprites()?;
527
 
535
 
528
         scene_mesh_builder = self.update_mesh_builder_with_debug(scene_mesh_builder)?;
536
         scene_mesh_builder = self.update_mesh_builder_with_debug(scene_mesh_builder)?;
529
         scene_mesh_builder = self.update_mesh_builder_with_selected_items(scene_mesh_builder)?;
537
         scene_mesh_builder = self.update_mesh_builder_with_selected_items(scene_mesh_builder)?;
547
 
555
 
548
         graphics::present(ctx)?;
556
         graphics::present(ctx)?;
549
 
557
 
550
-        println!("FPS: {}", ggez::timer::fps(ctx));
558
+        // println!("FPS: {}", ggez::timer::fps(ctx));
551
         Ok(())
559
         Ok(())
552
     }
560
     }
553
 
561