Bastien Sevajol преди 3 години
родител
ревизия
51de72ef2c
променени са 1 файла, в които са добавени 4 реда и са изтрити 9 реда
  1. 4 9
      src/scene/main.rs

+ 4 - 9
src/scene/main.rs Целия файл

@@ -99,24 +99,19 @@ impl MainState {
99 99
     pub fn new(ctx: &mut Context) -> GameResult<MainState> {
100 100
         let map = Map::new(&Path::new("resources/map1.tmx"))?;
101 101
 
102
-        // FIXME manage error
103
-        let sprite_sheet_image = graphics::Image::new(ctx, "/sprite_sheet.png").unwrap();
102
+        let sprite_sheet_image = graphics::Image::new(ctx, "/sprite_sheet.png")?;
104 103
         let sprite_sheet_batch = graphics::spritebatch::SpriteBatch::new(sprite_sheet_image);
105 104
 
106 105
         let map_image = graphics::Image::new(
107 106
             ctx,
108 107
             &Path::new(&format!("/{}", &map.background_image.source)),
109
-        )
110
-        .unwrap();
108
+        )?;
111 109
         let map_batch = graphics::spritebatch::SpriteBatch::new(map_image);
112 110
 
113
-        // FIXME manage error
114
-        let ui_image = graphics::Image::new(ctx, "/ui.png").unwrap();
111
+        let ui_image = graphics::Image::new(ctx, "/ui.png")?;
115 112
         let ui_batch = graphics::spritebatch::SpriteBatch::new(ui_image);
116 113
 
117
-        // FIXME manage error
118
-        let terrain_image =
119
-            graphics::Image::new(ctx, format!("/{}", map.terrain_image.source)).unwrap();
114
+        let terrain_image = graphics::Image::new(ctx, format!("/{}", map.terrain_image.source))?;
120 115
         let mut terrain_batch = graphics::spritebatch::SpriteBatch::new(terrain_image);
121 116
         terrain_batch = update_terrain_batch(terrain_batch, &map);
122 117