From ba2e052830efbbff9121260ce7dcb18d1ea34ef2 Mon Sep 17 00:00:00 2001 From: Aragas Date: Thu, 22 Sep 2016 21:00:45 +0300 Subject: [PATCH] [Texture Disposal] This should be okay?? --- .../Screens/Battle/BattleGrowStatsScreen.vb | 5 +++++ .../2.5DHero/Screens/BattleIntroScreen.vb | 5 +++++ 2.5DHero/2.5DHero/Screens/GUI/Canvas.vb | 11 ++++++++++ .../2.5DHero/Screens/GUI/DonationScreen.vb | 8 +++++++ .../Screens/Inventory/ChoosePokemonScreen.vb | 17 +++++++++++++++ .../Screens/Inventory/InventoryScreen.vb | 14 +++++++++++++ .../Screens/Inventory/ItemDetailScreen.vb | 8 +++++++ .../2.5DHero/Screens/MainMenu/PauseScreen.vb | 8 +++++++ 2.5DHero/2.5DHero/Screens/NewGameScreen.vb | 8 +++++++ 2.5DHero/2.5DHero/Screens/OptionScreen.vb | 21 +++++++++++++++++++ .../Screens/Pokemon/TeachMovesScreen.vb | 5 +++++ 2.5DHero/2.5DHero/Screens/SaveScreen.vb | 5 +++++ 2.5DHero/2.5DHero/Screens/TrainerScreen.vb | 8 +++++++ 13 files changed, 123 insertions(+) diff --git a/2.5DHero/2.5DHero/Screens/Battle/BattleGrowStatsScreen.vb b/2.5DHero/2.5DHero/Screens/Battle/BattleGrowStatsScreen.vb index 27fb370b4..0f09f655e 100644 --- a/2.5DHero/2.5DHero/Screens/Battle/BattleGrowStatsScreen.vb +++ b/2.5DHero/2.5DHero/Screens/Battle/BattleGrowStatsScreen.vb @@ -97,4 +97,9 @@ End If End Sub + Protected Overrides Sub Finalize() + If CanvasTexture1 IsNot Nothing + CanvasTexture1.Dispose() + End If + End Sub End Class \ No newline at end of file diff --git a/2.5DHero/2.5DHero/Screens/BattleIntroScreen.vb b/2.5DHero/2.5DHero/Screens/BattleIntroScreen.vb index c8d1bb48a..f011eb88a 100644 --- a/2.5DHero/2.5DHero/Screens/BattleIntroScreen.vb +++ b/2.5DHero/2.5DHero/Screens/BattleIntroScreen.vb @@ -522,4 +522,9 @@ Return startTime + duration < Date.Now End Function + Protected Overrides Sub Finalize() + If blurTexture IsNot Nothing + blurTexture.Dispose() + End If + End Sub End Class \ No newline at end of file diff --git a/2.5DHero/2.5DHero/Screens/GUI/Canvas.vb b/2.5DHero/2.5DHero/Screens/GUI/Canvas.vb index 29b3aecd8..60ca01dbd 100644 --- a/2.5DHero/2.5DHero/Screens/GUI/Canvas.vb +++ b/2.5DHero/2.5DHero/Screens/GUI/Canvas.vb @@ -252,6 +252,12 @@ Core.SpriteBatch.Draw(Me.Texture, r, Color.White) End Sub + + Protected Overrides Sub Finalize() + If Texture IsNot Nothing + Texture.Dispose() + End If + End Sub End Structure Shared gradientConfigs As New List(Of GradientConfiguration) @@ -282,4 +288,9 @@ Core.SpriteBatch.Draw(Canvas, startPoint, Nothing, Color, CSng(angle), Vector2.Zero, New Vector2(CSng(length), CSng(width)), SpriteEffects.None, 0) End Sub + Protected Overrides Sub Finalize() + If Canvas IsNot Nothing + Canvas.Dispose() + End If + End Sub End Class \ No newline at end of file diff --git a/2.5DHero/2.5DHero/Screens/GUI/DonationScreen.vb b/2.5DHero/2.5DHero/Screens/GUI/DonationScreen.vb index bcb4f734a..a05f5b51e 100644 --- a/2.5DHero/2.5DHero/Screens/GUI/DonationScreen.vb +++ b/2.5DHero/2.5DHero/Screens/GUI/DonationScreen.vb @@ -73,4 +73,12 @@ Core.SpriteBatch.DrawString(FontManager.MainFont, Localization.GetString("donation_screen_backadvice"), New Vector2(CInt(Core.windowSize.Width / 2) - FontManager.MainFont.MeasureString("Press E to close").X / 2, 640), Color.White) End Sub + Protected Overrides Sub Finalize() + If texture1 IsNot Nothing + texture1.Dispose() + End If + If texture2 IsNot Nothing + texture2.Dispose() + End If + End Sub End Class \ No newline at end of file diff --git a/2.5DHero/2.5DHero/Screens/Inventory/ChoosePokemonScreen.vb b/2.5DHero/2.5DHero/Screens/Inventory/ChoosePokemonScreen.vb index 961c8f674..a4addd473 100644 --- a/2.5DHero/2.5DHero/Screens/Inventory/ChoosePokemonScreen.vb +++ b/2.5DHero/2.5DHero/Screens/Inventory/ChoosePokemonScreen.vb @@ -358,4 +358,21 @@ Me.moveLearnArg = arg End Sub + Protected Overrides Sub Finalize() + If BorderTexture1 IsNot Nothing + BorderTexture1.Dispose() + End If + If BorderTexture2 IsNot Nothing + BorderTexture2.Dispose() + End If + If BorderTexture3 IsNot Nothing + BorderTexture3.Dispose() + End If + If BorderTexture4 IsNot Nothing + BorderTexture4.Dispose() + End If + If BorderTexture5 IsNot Nothing + BorderTexture5.Dispose() + End If + End Sub End Class \ No newline at end of file diff --git a/2.5DHero/2.5DHero/Screens/Inventory/InventoryScreen.vb b/2.5DHero/2.5DHero/Screens/Inventory/InventoryScreen.vb index 8e8301b18..7756b51a6 100644 --- a/2.5DHero/2.5DHero/Screens/Inventory/InventoryScreen.vb +++ b/2.5DHero/2.5DHero/Screens/Inventory/InventoryScreen.vb @@ -326,4 +326,18 @@ ChangeBag() End Sub + Protected Overrides Sub Finalize() + If texture1 IsNot Nothing + texture1.Dispose() + End If + If texture2 IsNot Nothing + texture2.Dispose() + End If + If texture3 IsNot Nothing + texture3.Dispose() + End If + If texture4 IsNot Nothing + texture4.Dispose() + End If + End Sub End Class \ No newline at end of file diff --git a/2.5DHero/2.5DHero/Screens/Inventory/ItemDetailScreen.vb b/2.5DHero/2.5DHero/Screens/Inventory/ItemDetailScreen.vb index 66ce7f917..18652226f 100644 --- a/2.5DHero/2.5DHero/Screens/Inventory/ItemDetailScreen.vb +++ b/2.5DHero/2.5DHero/Screens/Inventory/ItemDetailScreen.vb @@ -198,4 +198,12 @@ MenuItems.Add(Localization.GetString("item_detail_screen_back")) End Sub + Protected Overrides Sub Finalize() + If CanvasTexture1 IsNot Nothing + CanvasTexture1.Dispose() + End If + If CanvasTexture2 IsNot Nothing + CanvasTexture2.Dispose() + End If + End Sub End Class \ No newline at end of file diff --git a/2.5DHero/2.5DHero/Screens/MainMenu/PauseScreen.vb b/2.5DHero/2.5DHero/Screens/MainMenu/PauseScreen.vb index f55e1fdbb..9638dba46 100644 --- a/2.5DHero/2.5DHero/Screens/MainMenu/PauseScreen.vb +++ b/2.5DHero/2.5DHero/Screens/MainMenu/PauseScreen.vb @@ -279,4 +279,12 @@ MusicManager.ForceVolumeUpdate() End Sub + Protected Overrides Sub Finalize() + If CanvasTexture1 IsNot Nothing + CanvasTexture1.Dispose() + End If + If CanvasTexture2 IsNot Nothing + CanvasTexture2.Dispose() + End If + End Sub End Class \ No newline at end of file diff --git a/2.5DHero/2.5DHero/Screens/NewGameScreen.vb b/2.5DHero/2.5DHero/Screens/NewGameScreen.vb index 4f5bfe126..184872a88 100644 --- a/2.5DHero/2.5DHero/Screens/NewGameScreen.vb +++ b/2.5DHero/2.5DHero/Screens/NewGameScreen.vb @@ -553,4 +553,12 @@ Return Localization.GetString("new_game_oak_name_1") & name & Localization.GetString("new_game_oak_name_2") End Function + Protected Overrides Sub Finalize() + If texture1 IsNot Nothing + texture1.Dispose() + End If + If texture2 IsNot Nothing + texture2.Dispose() + End If + End Sub End Class \ No newline at end of file diff --git a/2.5DHero/2.5DHero/Screens/OptionScreen.vb b/2.5DHero/2.5DHero/Screens/OptionScreen.vb index 1c2ee4397..1f5370d1b 100644 --- a/2.5DHero/2.5DHero/Screens/OptionScreen.vb +++ b/2.5DHero/2.5DHero/Screens/OptionScreen.vb @@ -541,6 +541,14 @@ End If End Sub + Protected Overrides Sub Finalize() + If texture1 IsNot Nothing + texture1.Dispose() + End If + If texture2 IsNot Nothing + texture2.Dispose() + End If + End Sub End Class Class CommandButton @@ -622,6 +630,14 @@ End If End Sub + Protected Overrides Sub Finalize() + If texture1 IsNot Nothing + texture1.Dispose() + End If + If texture2 IsNot Nothing + texture2.Dispose() + End If + End Sub End Class Class ScrollBar @@ -803,4 +819,9 @@ #End Region + Protected Overrides Sub Finalize() + If texture1 IsNot Nothing + texture1.Dispose() + End If + End Sub End Class \ No newline at end of file diff --git a/2.5DHero/2.5DHero/Screens/Pokemon/TeachMovesScreen.vb b/2.5DHero/2.5DHero/Screens/Pokemon/TeachMovesScreen.vb index 458a30899..cd0db3874 100644 --- a/2.5DHero/2.5DHero/Screens/Pokemon/TeachMovesScreen.vb +++ b/2.5DHero/2.5DHero/Screens/Pokemon/TeachMovesScreen.vb @@ -216,4 +216,9 @@ End If End Sub + Protected Overrides Sub Finalize() + If texture1 IsNot Nothing + texture1.Dispose() + End If + End Sub End Class \ No newline at end of file diff --git a/2.5DHero/2.5DHero/Screens/SaveScreen.vb b/2.5DHero/2.5DHero/Screens/SaveScreen.vb index 28456ed93..fbd00988b 100644 --- a/2.5DHero/2.5DHero/Screens/SaveScreen.vb +++ b/2.5DHero/2.5DHero/Screens/SaveScreen.vb @@ -127,4 +127,9 @@ End If End Sub + Protected Overrides Sub Finalize() + If CanvasTexture1 IsNot Nothing + CanvasTexture1.Dispose() + End If + End Sub End Class \ No newline at end of file diff --git a/2.5DHero/2.5DHero/Screens/TrainerScreen.vb b/2.5DHero/2.5DHero/Screens/TrainerScreen.vb index e65774f13..5951e1267 100644 --- a/2.5DHero/2.5DHero/Screens/TrainerScreen.vb +++ b/2.5DHero/2.5DHero/Screens/TrainerScreen.vb @@ -195,4 +195,12 @@ End If End Sub + Protected Overrides Sub Finalize() + If CanvasTexture1 IsNot Nothing + CanvasTexture1.Dispose() + End If + If charTexture IsNot Nothing + charTexture.Dispose() + End If + End Sub End Class \ No newline at end of file