add percentage in cards game
This commit is contained in:
parent
c67ae2834d
commit
021a6c67ea
|
@ -22,9 +22,10 @@ impl MemoryCardsGameScene {
|
|||
|
||||
pub fn update_stats(&self) {
|
||||
self.imp().stats_label.set_text(&format!(
|
||||
"Correct|Incorrect: {}|{}",
|
||||
"Correct|Incorrect: {}|{} ({:.2}%)",
|
||||
self.imp().correct.borrow(),
|
||||
self.imp().incorrect.borrow()
|
||||
self.imp().incorrect.borrow(),
|
||||
100.0 * f64::from(*self.imp().correct.borrow() as i32) / f64::from((*self.imp().incorrect.borrow() + *self.imp().correct.borrow()) as i32)
|
||||
));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue