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(); + } +}