From 41ccd56919d061ae99faa4f17be7db9d8a931b7c Mon Sep 17 00:00:00 2001 From: Corwin Date: Sat, 6 Aug 2022 18:37:25 +0100 Subject: [PATCH] new function for blend --- agb/src/display/blend.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/agb/src/display/blend.rs b/agb/src/display/blend.rs index 1104416f..4b6ee180 100644 --- a/agb/src/display/blend.rs +++ b/agb/src/display/blend.rs @@ -28,6 +28,17 @@ const BLEND_ALPHAS: *mut u16 = 0x0400_0052 as *mut _; const BLEND_FADES: *mut u16 = 0x0400_0054 as *mut _; impl Blend { + pub(crate) fn new() -> Self { + let blend = Self { + targets: 0, + blend_weights: 0, + fade_weight: 0, + }; + blend.commit(); + + blend + } + pub fn reset_targets(&mut self) -> &mut Self { self.targets = 0; @@ -107,3 +118,9 @@ impl Blend { } } } + +impl Drop for Blend { + fn drop(&mut self) { + self.reset().commit(); + } +}