diff --git a/agb/src/display/font.rs b/agb/src/display/font.rs index 70b8a136..badafc56 100644 --- a/agb/src/display/font.rs +++ b/agb/src/display/font.rs @@ -161,3 +161,13 @@ impl<'a> TextRenderer<'a> { } } } + +impl<'a> Drop for TextRenderer<'a> { + fn drop(&mut self) { + let tiles = core::mem::take(&mut self.tiles); + + for (_, tile) in tiles.into_iter() { + self.vram_manager.remove_dynamic_tile(tile); + } + } +}