new function for blend

This commit is contained in:
Corwin 2022-08-06 18:37:25 +01:00
parent d0b3d9e7b3
commit 41ccd56919

View file

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