From 96401c283378726c0a93e3c9a6954d7ba04253ef Mon Sep 17 00:00:00 2001 From: Corwin Date: Sat, 8 Oct 2022 23:44:22 +0100 Subject: [PATCH] implement multiplication by scalar --- agb/src/display/affine.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/agb/src/display/affine.rs b/agb/src/display/affine.rs index 5cd53ecc..222293ec 100644 --- a/agb/src/display/affine.rs +++ b/agb/src/display/affine.rs @@ -193,6 +193,26 @@ impl Mul for AffineMatrix { } } +impl Mul> for AffineMatrix { + type Output = Self; + fn mul(self, rhs: Num) -> Self::Output { + self * AffineMatrix { + a: rhs, + b: 0.into(), + c: 0.into(), + d: rhs, + x: 0.into(), + y: 0.into(), + } + } +} + +impl MulAssign> for AffineMatrix { + fn mul_assign(&mut self, rhs: Num) { + *self = *self * rhs; + } +} + impl MulAssign for AffineMatrix { fn mul_assign(&mut self, rhs: Self) { *self = *self * rhs;