rust/lib-hedgewars-engine/src/render/atlas.rs
changeset 15190 e2adb40c7988
parent 15186 9cf0c2f44f0e
child 15286 16bd389fc735
--- a/rust/lib-hedgewars-engine/src/render/atlas.rs	Fri Jun 21 20:27:37 2019 +0200
+++ b/rust/lib-hedgewars-engine/src/render/atlas.rs	Sat Jun 22 00:18:24 2019 +0300
@@ -65,7 +65,7 @@
         write!(
             f,
             "{:.2}%",
-            self.used() as f32 / self.total() as f32 / 100.0
+            self.used() as f32 / self.total() as f32 * 100.0
         )?;
         Ok(())
     }
@@ -249,6 +249,14 @@
             self.consume_index()
         }
     }
+
+    pub fn used_space(&self) -> String {
+        self.atlases
+            .iter()
+            .enumerate()
+            .map(|(i, a)| format!("{}: {:?}", i, a.used_space()))
+            .join("\n")
+    }
 }
 
 impl Index<SpriteIndex> for AtlasCollection {