Not even ashamed of my dirty fixes

This commit is contained in:
Aragas 2016-10-06 18:18:10 +03:00
parent 54a9c13001
commit 8922030727
5 changed files with 39 additions and 4 deletions

View File

@ -180,6 +180,7 @@
Dim t1 As Texture2D = TextureManager.GetTexture("GUI\Intro\VSIntro", New Rectangle(CInt(barPosition.X), CInt(barPosition.Y), 128, 64), "") Dim t1 As Texture2D = TextureManager.GetTexture("GUI\Intro\VSIntro", New Rectangle(CInt(barPosition.X), CInt(barPosition.Y), 128, 64), "")
Dim t2 As Texture2D = TextureManager.GetTexture("GUI\Intro\" & Trainer.VSImageOrigin, New Rectangle(CInt(VSPosition.X), CInt(VSPosition.Y), Trainer.VSImageSize.Width, Trainer.VSImageSize.Height), "") Dim t2 As Texture2D = TextureManager.GetTexture("GUI\Intro\" & Trainer.VSImageOrigin, New Rectangle(CInt(VSPosition.X), CInt(VSPosition.Y), Trainer.VSImageSize.Width, Trainer.VSImageSize.Height), "")
Dim t3 As Texture2D = TextureManager.GetTexture("NPC\" & Trainer.SpriteName, New Rectangle(0, 64, 32, 32)) Dim t3 As Texture2D = TextureManager.GetTexture("NPC\" & Trainer.SpriteName, New Rectangle(0, 64, 32, 32))
Dim t3Disp = false
Dim t4 As Texture2D = Nothing Dim t4 As Texture2D = Nothing
If Trainer.DoubleTrainer = True Then If Trainer.DoubleTrainer = True Then
t4 = TextureManager.GetTexture("NPC\" & Trainer.SpriteName2, New Rectangle(0, 64, 32, 32)) t4 = TextureManager.GetTexture("NPC\" & Trainer.SpriteName2, New Rectangle(0, 64, 32, 32))
@ -192,6 +193,7 @@
Dim spriteSize As New Vector2(t.Width / 3.0F, t.Height / 4.0F) Dim spriteSize As New Vector2(t.Width / 3.0F, t.Height / 4.0F)
'It will leak 'It will leak
t3 = TextureManager.TextureRectangle(t, New Rectangle(0, CInt(spriteSize.Y * 2), CInt(spriteSize.X), CInt(spriteSize.Y))) t3 = TextureManager.TextureRectangle(t, New Rectangle(0, CInt(spriteSize.Y * 2), CInt(spriteSize.X), CInt(spriteSize.Y)))
t3Disp = true
End If End If
End If End If
End If End If
@ -220,6 +222,10 @@
Core.SpriteBatch.Draw(t3, New Rectangle(Core.windowSize.Width - 310, CInt(Core.windowSize.Height / 2 - 230), 256, 256), Color.White) Core.SpriteBatch.Draw(t3, New Rectangle(Core.windowSize.Width - 310, CInt(Core.windowSize.Height / 2 - 230), 256, 256), Color.White)
End If End If
Core.SpriteBatch.Draw(t2, New Rectangle(420 - CInt(CInt(1.29 * value) / 3), CInt(Core.windowSize.Height / 2 - 20) - CInt(CInt(1 * value) / 3), CInt(1.12 * CInt(value / 1.5F)), 1 * CInt(value / 1.5F)), Color.White) Core.SpriteBatch.Draw(t2, New Rectangle(420 - CInt(CInt(1.29 * value) / 3), CInt(Core.windowSize.Height / 2 - 20) - CInt(CInt(1 * value) / 3), CInt(1.12 * CInt(value / 1.5F)), 1 * CInt(value / 1.5F)), Color.White)
If t3Disp Then
t3.Dispose()
End If
End Sub End Sub
Private Function ReplaceIntroName(ByVal Name As String) As String Private Function ReplaceIntroName(ByVal Name As String) As String
@ -243,6 +249,7 @@
Dim t1 As Texture2D = TextureManager.GetTexture("GUI\Intro\VSIntro", New Rectangle(CInt(barPosition.X), CInt(barPosition.Y), 128, 64), "") Dim t1 As Texture2D = TextureManager.GetTexture("GUI\Intro\VSIntro", New Rectangle(CInt(barPosition.X), CInt(barPosition.Y), 128, 64), "")
Dim t2 As Texture2D = TextureManager.GetTexture("GUI\Intro\VSIntro", New Rectangle(CInt(VSPosition.X), CInt(VSPosition.Y), 61, 54), "") Dim t2 As Texture2D = TextureManager.GetTexture("GUI\Intro\VSIntro", New Rectangle(CInt(VSPosition.X), CInt(VSPosition.Y), 61, 54), "")
Dim t3 As Texture2D = TextureManager.GetTexture("NPC\" & Trainer.SpriteName, New Rectangle(0, 64, 32, 32)) Dim t3 As Texture2D = TextureManager.GetTexture("NPC\" & Trainer.SpriteName, New Rectangle(0, 64, 32, 32))
Dim t3Disp = false
Dim t4 As Texture2D = Nothing Dim t4 As Texture2D = Nothing
If Trainer.DoubleTrainer = True Then If Trainer.DoubleTrainer = True Then
t4 = TextureManager.GetTexture("NPC\" & Trainer.SpriteName2, New Rectangle(0, 64, 32, 32)) t4 = TextureManager.GetTexture("NPC\" & Trainer.SpriteName2, New Rectangle(0, 64, 32, 32))
@ -255,6 +262,7 @@
Dim spriteSize As New Vector2(t.Width / 3.0F, t.Height / 4.0F) Dim spriteSize As New Vector2(t.Width / 3.0F, t.Height / 4.0F)
'It will leak 'It will leak
t3 = TextureManager.TextureRectangle(t, New Rectangle(0, CInt(spriteSize.Y * 2), CInt(spriteSize.X), CInt(spriteSize.Y))) t3 = TextureManager.TextureRectangle(t, New Rectangle(0, CInt(spriteSize.Y * 2), CInt(spriteSize.X), CInt(spriteSize.Y)))
t3Disp = true
End If End If
End If End If
End If End If
@ -281,6 +289,10 @@
Core.SpriteBatch.DrawString(FontManager.InGameFont, Trainer.Name, New Vector2((Core.windowSize.Width - (textPosition - 300)).Clamp(CInt(Core.windowSize.Width / 2 - tWidth / 2), Core.windowSize.Width), Core.windowSize.Height - 180), Color.White, 0.0F, New Vector2(0), 3.0F, SpriteEffects.None, 0.0F) Core.SpriteBatch.DrawString(FontManager.InGameFont, Trainer.Name, New Vector2((Core.windowSize.Width - (textPosition - 300)).Clamp(CInt(Core.windowSize.Width / 2 - tWidth / 2), Core.windowSize.Width), Core.windowSize.Height - 180), Color.White, 0.0F, New Vector2(0), 3.0F, SpriteEffects.None, 0.0F)
End If End If
End If End If
If t3Disp Then
t3.Dispose()
End If
End Sub End Sub
Public Overrides Sub Update() Public Overrides Sub Update()

View File

@ -424,4 +424,15 @@
End Class End Class
Protected Overrides Sub Finalize()
If Sprites IsNot Nothing And Sprites.Count > 1
For Each sprite in Sprites
If sprite IsNot Nothing
sprite.Dispose()
End If
Next
End If
End Sub
End Class End Class

View File

@ -475,7 +475,9 @@
If drawObjects(3) = True Then If drawObjects(3) = True Then
For Each Pokes As Roaming In RoamingPoke For Each Pokes As Roaming In RoamingPoke
Core.SpriteBatch.Draw(Pokes.getTexture(), Pokes.getRectangle(mapOffset), Color.White) Dim text = Pokes.getTexture()
Core.SpriteBatch.Draw(text, Pokes.getRectangle(mapOffset), Color.White)
text.Dispose()
Next Next
End If End If

View File

@ -368,7 +368,10 @@
If ControllerHandler.ButtonPressed(Buttons.X) = True Then If ControllerHandler.ButtonPressed(Buttons.X) = True Then
'It will leak 'It will leak
Core.SetScreen(New InputScreen(Core.CurrentScreen, "Player", InputScreen.InputModes.Name, Me.CurrentText, 14, {TextureManager.TextureRectangle(TextureManager.GetTexture("Textures\NPC\" & startSkins(SkinIndex)), New Rectangle(0, 64, 32, 32))}.ToList(), AddressOf Me.ConfirmInput)) Core.SetScreen(New InputScreen(Core.CurrentScreen, "Player", InputScreen.InputModes.Name, Me.CurrentText, 14,
{
TextureManager.TextureRectangle(TextureManager.GetTexture("Textures\NPC\" & startSkins(SkinIndex)),New Rectangle(0, 64, 32, 32))
}.ToList(), AddressOf Me.ConfirmInput))
Else Else
KeyBindings.GetNameInput(Me.CurrentText, 14) KeyBindings.GetNameInput(Me.CurrentText, 14)
@ -561,5 +564,8 @@
If texture2 IsNot Nothing If texture2 IsNot Nothing
texture2.Dispose() texture2.Dispose()
End If End If
If skinTexture IsNot Nothing
skinTexture.Dispose()
End If
End Sub End Sub
End Class End Class

View File

@ -439,7 +439,9 @@ Public Class TradeScreen
If i <= Me.loadedBuyCategories.Count - 1 Then If i <= Me.loadedBuyCategories.Count - 1 Then
Dim p As Integer = i - Scroll Dim p As Integer = i - Scroll
DrawButton(New Vector2(100, 100 + p * 96), 5, Me.loadedBuyCategories(i).ToString(), 16, GetItemTypeTexture(Me.loadedBuyCategories(i))) Dim texture As Texture2D = GetItemTypeTexture(Me.loadedBuyCategories(i))
DrawButton(New Vector2(100, 100 + p * 96), 5, Me.loadedBuyCategories(i).ToString(), 16, texture)
texture.Dispose()
End If End If
Next Next
@ -849,7 +851,9 @@ Public Class TradeScreen
If i <= Me.loadedSellCategories.Count - 1 Then If i <= Me.loadedSellCategories.Count - 1 Then
Dim p As Integer = i - Scroll Dim p As Integer = i - Scroll
DrawButton(New Vector2(100, 100 + p * 96), 5, Me.loadedSellCategories(i).ToString(), 16, GetItemTypeTexture(Me.loadedSellCategories(i))) Dim texture As Texture2D = GetItemTypeTexture(Me.loadedSellCategories(i))
DrawButton(New Vector2(100, 100 + p * 96), 5, Me.loadedSellCategories(i).ToString(), 16, texture)
texture.Dispose()
End If End If
Next Next