diff --git a/src/ddr/ssq.rs b/src/ddr/ssq.rs index a2c8a59..4d11929 100644 --- a/src/ddr/ssq.rs +++ b/src/ddr/ssq.rs @@ -59,6 +59,19 @@ impl Into> for PlayerRow { } } +impl fmt::Display for PlayerRow { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!( + f, + "{}{}{}{}", + if self.left { "←" } else { " " }, + if self.down { "↓" } else { " " }, + if self.up { "↑" } else { " " }, + if self.right { "→" } else { " " }, + ) + } +} + #[derive(Debug, Clone, PartialEq)] pub enum Row { Single(PlayerRow), @@ -79,6 +92,16 @@ impl Into> for Row { } } +impl fmt::Display for Row { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + let player_rows = match self { + Self::Single(player_row) => vec![player_row], + Self::Double(player_row1, player_row2) => vec![player_row1, player_row2], + }; + write!(f, "{}", utils::join_display_values(player_rows, " ")) + } +} + impl Row { fn new(byte: u8, players: u8) -> Self { match players {