Replaced TextureManager.TextureRectangle with TextureManager.GetTexture, removed all those temp leak fixes

This commit is contained in:
Aragas 2016-10-06 20:42:31 +03:00
parent 3ef08819a9
commit 20861de0fb
23 changed files with 90 additions and 362 deletions

View File

@ -225,7 +225,6 @@
Return 1 Return 1
End Function End Function
Dim dispTex As Boolean = false
Private Sub ChangeTexture() Private Sub ChangeTexture()
If Not Me.Texture Is Nothing Then If Not Me.Texture Is Nothing Then
Dim r As New Rectangle(0, 0, 0, 0) Dim r As New Rectangle(0, 0, 0, 0)
@ -272,9 +271,7 @@
If r <> lastRectangle Then If r <> lastRectangle Then
lastRectangle = r lastRectangle = r
Dim t As Texture2D = TextureManager.TextureRectangle(Me.Texture, r, 1) Textures(0) = TextureManager.GetTexture(Me.Texture, r, 1)
Textures(0) = t
dispTex = true
End If End If
End If End If
End Sub End Sub
@ -749,9 +746,4 @@
#End Region #End Region
Protected Overrides Sub Finalize()
If Textures(0) IsNot Nothing And dispTex
Textures(0).Dispose()
End If
End Sub
End Class End Class

View File

@ -124,7 +124,6 @@
Return texturePath & TextureID Return texturePath & TextureID
End Function End Function
Dim dispTex As Boolean = false
Private Sub ChangeTexture() Private Sub ChangeTexture()
If Not Me.Texture Is Nothing Then If Not Me.Texture Is Nothing Then
Dim r As New Rectangle(0, 0, 0, 0) Dim r As New Rectangle(0, 0, 0, 0)
@ -157,9 +156,7 @@
If r <> lastRectangle Then If r <> lastRectangle Then
lastRectangle = r lastRectangle = r
Dim t As Texture2D = TextureManager.TextureRectangle(Me.Texture, r, 1) Textures(0) = TextureManager.GetTexture(Me.Texture, r, 1)
Textures(0) = t
dispTex = true
End If End If
End If End If
End Sub End Sub
@ -372,10 +369,4 @@
Return Nothing Return Nothing
End Function End Function
Protected Overrides Sub Finalize()
If Textures(0) IsNot Nothing And dispTex
Textures(0).Dispose()
End If
End Sub
End Class End Class

View File

@ -97,7 +97,6 @@
Return True Return True
End Function End Function
Dim dispTex As Boolean = false
Private Sub ChangeTexture() Private Sub ChangeTexture()
If Me.Texture Is Nothing Then If Me.Texture Is Nothing Then
Dim path As String = Me.PokemonTexture.Replace("[POKEMON|N]", "Pokemon\Overworld\Normal\").Replace("[POKEMON|S]", "Pokemon\Overworld\Shiny\") Dim path As String = Me.PokemonTexture.Replace("[POKEMON|N]", "Pokemon\Overworld\Normal\").Replace("[POKEMON|S]", "Pokemon\Overworld\Shiny\")
@ -134,9 +133,7 @@
If r <> lastRectangle Then If r <> lastRectangle Then
lastRectangle = r lastRectangle = r
Dim t As Texture2D = TextureManager.TextureRectangle(Me.Texture, r, 1) Textures(0) = TextureManager.GetTexture(Me.Texture, r, 1)
Textures(0) = t
dispTex = true
End If End If
End Sub End Sub
@ -175,10 +172,4 @@
Catch : End Try Catch : End Try
End Sub End Sub
Protected Overrides Sub Finalize()
If Textures(0) IsNot Nothing And dispTex
Textures(0).Dispose()
End If
End Sub
End Class End Class

View File

@ -34,7 +34,6 @@ Public Class OverworldPokemon
Me.DropUpdateUnlessDrawn = False Me.DropUpdateUnlessDrawn = False
End Sub End Sub
Dim dispTex As Boolean = false
Private Sub ChangeTexture() Private Sub ChangeTexture()
If Me.Texture Is Nothing Then If Me.Texture Is Nothing Then
Me.Texture = PokemonReference.GetOverworldTexture() Me.Texture = PokemonReference.GetOverworldTexture()
@ -63,9 +62,8 @@ Public Class OverworldPokemon
If r <> lastRectangle Then If r <> lastRectangle Then
lastRectangle = r lastRectangle = r
Dim t As Texture2D = TextureManager.TextureRectangle(Me.Texture, r, 1) Dim t As Texture2D = TextureManager.GetTexture(Me.Texture, r, 1)
Textures(0) = t Textures(0) = t
dispTex = true
End If End If
End Sub End Sub
@ -271,9 +269,4 @@ Public Class OverworldPokemon
Me.ChangeTexture() Me.ChangeTexture()
End Sub End Sub
Protected Overrides Sub Finalize()
If Textures(0) IsNot Nothing And dispTex
Textures(0).Dispose()
End If
End Sub
End Class End Class

View File

@ -113,7 +113,6 @@
End If End If
End Sub End Sub
Dim dispTex As Boolean = false
Public Sub ChangeTexture() Public Sub ChangeTexture()
If Not Me.Texture Is Nothing Then If Not Me.Texture Is Nothing Then
Dim r As New Rectangle(0, 0, 0, 0) Dim r As New Rectangle(0, 0, 0, 0)
@ -147,9 +146,8 @@
Core.Player.Skin = SkinName Core.Player.Skin = SkinName
Try Try
Dim t As Texture2D = TextureManager.TextureRectangle(Me.Texture, r, 1) Dim t As Texture2D = TextureManager.GetTexture(Me.Texture, r, 1)
Textures(0) = t Textures(0) = t
dispTex = true
Catch Catch
Logger.Log(Logger.LogTypes.Warning, "OwnPlayer.vb: Error assigning a new texture to the player.") Logger.Log(Logger.LogTypes.Warning, "OwnPlayer.vb: Error assigning a new texture to the player.")
End Try End Try
@ -207,9 +205,4 @@
Return OwnPlayer.AnimationDelayLenght Return OwnPlayer.AnimationDelayLenght
End Function End Function
Protected Overrides Sub Finalize()
If Textures(0) IsNot Nothing And dispTex
Textures(0).Dispose()
End If
End Sub
End Class End Class

View File

@ -7,6 +7,7 @@ Public Class TextureManager
End Sub End Sub
Public Shared TextureList As New Dictionary(Of String, Texture2D) Public Shared TextureList As New Dictionary(Of String, Texture2D)
Public Shared TextureRectList As New Dictionary(Of KeyValuePair(Of Int32, Rectangle), Texture2D)
''' <summary> ''' <summary>
''' Returns a texture. ''' Returns a texture.
@ -128,7 +129,20 @@ Public Class TextureManager
Return GetTexture(Name, r, "Textures\") Return GetTexture(Name, r, "Textures\")
End Function End Function
Public Shared Function TextureRectangle(ByVal Texture As Texture2D, ByVal Rectangle As Rectangle, Optional ByVal Factor As Integer = 1) As Texture2D Public Shared Function GetTexture(ByVal Texture As Texture2D, ByVal Rectangle As Rectangle, Optional ByVal Factor As Integer = 1) As Texture2D
Dim tex As Texture2D
If TextureRectList.TryGetValue(New KeyValuePair(Of Int32, Rectangle)(Texture.GetHashCode(), Rectangle), tex) then
Return tex
End If
tex = TextureRectangle(Texture, Rectangle, Factor)
TextureRectList.Add(New KeyValuePair(Of Integer, Rectangle)(Texture.GetHashCode(), Rectangle), tex)
Return tex
End Function
Private Shared Function TextureRectangle(ByVal Texture As Texture2D, ByVal Rectangle As Rectangle, Optional ByVal Factor As Integer = 1) As Texture2D
If IsNothing(Rectangle) Then If IsNothing(Rectangle) Then
Return Texture Return Texture
Else Else

View File

@ -18,7 +18,6 @@
Public Sub New(ByVal currentScreen As Screen, ByVal p As Pokemon, ByVal OldStats() As Integer) Public Sub New(ByVal currentScreen As Screen, ByVal p As Pokemon, ByVal OldStats() As Integer)
Me.mainTexture = TextureManager.GetTexture("GUI\Menus\Menu") Me.mainTexture = TextureManager.GetTexture("GUI\Menus\Menu")
CanvasTexture1 = TextureManager.TextureRectangle(mainTexture, New Rectangle(0, 0, 48, 48))
Me.PreScreen = currentScreen Me.PreScreen = currentScreen
Me.Identification = Identifications.BattleGrowStatsScreen Me.Identification = Identifications.BattleGrowStatsScreen
@ -33,13 +32,12 @@
Me.OldStats = OldStats Me.OldStats = OldStats
End Sub End Sub
Dim CanvasTexture1 As Texture2D
Public Overrides Sub Draw() Public Overrides Sub Draw()
PreScreen.Draw() PreScreen.Draw()
Dim p As New Vector2(Core.windowSize.Width - (544), 32) Dim p As New Vector2(Core.windowSize.Width - (544), 32)
Canvas.DrawImageBorder(CanvasTexture1, 2, New Rectangle(CInt(p.X), CInt(p.Y), 480, 352)) Canvas.DrawImageBorder(TextureManager.GetTexture(mainTexture, New Rectangle(0, 0, 48, 48)), 2, New Rectangle(CInt(p.X), CInt(p.Y), 480, 352))
Core.SpriteBatch.Draw(Pokemon.GetMenuTexture(), New Rectangle(CInt(p.X + 20), CInt(p.Y + 20), 64, 64), Color.White) Core.SpriteBatch.Draw(Pokemon.GetMenuTexture(), New Rectangle(CInt(p.X + 20), CInt(p.Y + 20), 64, 64), Color.White)
Core.SpriteBatch.DrawString(FontManager.InGameFont, Pokemon.GetDisplayName(), New Vector2(p.X + 90, p.Y + 32), Color.Black) Core.SpriteBatch.DrawString(FontManager.InGameFont, Pokemon.GetDisplayName(), New Vector2(p.X + 90, p.Y + 32), Color.Black)
@ -96,10 +94,4 @@
End If End If
End If End If
End Sub End Sub
Protected Overrides Sub Finalize()
If CanvasTexture1 IsNot Nothing
CanvasTexture1.Dispose()
End If
End Sub
End Class End Class

View File

@ -180,7 +180,6 @@
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))
@ -191,9 +190,7 @@
Dim t As Texture2D = GameJolt.Emblem.GetOnlineSprite(Trainer.GameJoltID) Dim t As Texture2D = GameJolt.Emblem.GetOnlineSprite(Trainer.GameJoltID)
If Not t Is Nothing Then If Not t Is Nothing Then
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 t3 = TextureManager.GetTexture(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
@ -222,10 +219,6 @@
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
@ -249,7 +242,6 @@
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))
@ -260,9 +252,7 @@
Dim t As Texture2D = GameJolt.Emblem.GetOnlineSprite(Trainer.GameJoltID) Dim t As Texture2D = GameJolt.Emblem.GetOnlineSprite(Trainer.GameJoltID)
If Not t Is Nothing Then If Not t Is Nothing Then
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 t3 = TextureManager.GetTexture(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
@ -289,10 +279,6 @@
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()
@ -536,9 +522,9 @@
Return startTime + duration < Date.Now Return startTime + duration < Date.Now
End Function End Function
Protected Overrides Sub Finalize() 'Protected Overrides Sub Finalize()
If blurTexture IsNot Nothing ' If blurTexture IsNot Nothing
blurTexture.Dispose() ' blurTexture.Dispose()
End If ' End If
End Sub 'End Sub
End Class End Class

View File

@ -253,11 +253,6 @@
End Sub End Sub
Protected Overrides Sub Finalize()
If Texture IsNot Nothing
Texture.Dispose()
End If
End Sub
End Structure End Structure
Shared gradientConfigs As New List(Of GradientConfiguration) Shared gradientConfigs As New List(Of GradientConfiguration)
@ -288,9 +283,4 @@
Core.SpriteBatch.Draw(Canvas, startPoint, Nothing, Color, CSng(angle), Vector2.Zero, New Vector2(CSng(length), CSng(width)), SpriteEffects.None, 0) Core.SpriteBatch.Draw(Canvas, startPoint, Nothing, Color, CSng(angle), Vector2.Zero, New Vector2(CSng(length), CSng(width)), SpriteEffects.None, 0)
End Sub End Sub
Protected Overrides Sub Finalize()
If Canvas IsNot Nothing
Canvas.Dispose()
End If
End Sub
End Class End Class

View File

@ -15,8 +15,6 @@
mainTexture = TextureManager.GetTexture("House", New Rectangle(83, 98, 10, 12)) mainTexture = TextureManager.GetTexture("House", New Rectangle(83, 98, 10, 12))
Me.scrollTexture = TextureManager.GetTexture("GUI\Menus\Menu") Me.scrollTexture = TextureManager.GetTexture("GUI\Menus\Menu")
texture1 = TextureManager.TextureRectangle(scrollTexture, New Rectangle(112, 12, 1, 1))
texture2 = TextureManager.TextureRectangle(scrollTexture, New Rectangle(113, 12, 1, 1))
Dim l As New List(Of String) Dim l As New List(Of String)
Dim oldL As List(Of String) = DonatorList.ToList() Dim oldL As List(Of String) = DonatorList.ToList()
@ -46,8 +44,6 @@
End If End If
End Sub End Sub
Dim texture1 As Texture2D
Dim texture2 As Texture2D
Public Overrides Sub Draw() Public Overrides Sub Draw()
Me.PreScreen.Draw() Me.PreScreen.Draw()
@ -64,7 +60,7 @@
Next Next
If DonatorList.Count > 13 Then If DonatorList.Count > 13 Then
Canvas.DrawScrollBar(New Vector2(CInt(Core.windowSize.Width / 2) + 180, 100), DonatorList.Count, 13, OffsetY, New Size(4, 500), False, texture1, texture2) Canvas.DrawScrollBar(New Vector2(CInt(Core.windowSize.Width / 2) + 180, 100), DonatorList.Count, 13, OffsetY, New Size(4, 500), False, TextureManager.GetTexture(scrollTexture, New Rectangle(112, 12, 1, 1)), TextureManager.GetTexture(scrollTexture, New Rectangle(113, 12, 1, 1)))
End If End If
Core.SpriteBatch.DrawString(FontManager.MainFont, t, New Vector2(CInt(Core.windowSize.Width / 2) - 180, 100), Color.Black) Core.SpriteBatch.DrawString(FontManager.MainFont, t, New Vector2(CInt(Core.windowSize.Width / 2) - 180, 100), Color.Black)
@ -73,12 +69,4 @@
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) 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 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 End Class

View File

@ -425,14 +425,5 @@
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

@ -9,6 +9,7 @@
Public index As Integer = 0 Public index As Integer = 0
Dim MainTexture As Texture2D Dim MainTexture As Texture2D
Dim Texture As Texture2D
Dim yOffset As Single = 0 Dim yOffset As Single = 0
Dim Item As Item Dim Item As Item
@ -44,11 +45,7 @@
Me.CanChooseFainted = canChooseFainted Me.CanChooseFainted = canChooseFainted
MainTexture = TextureManager.GetTexture("GUI\Menus\Menu") MainTexture = TextureManager.GetTexture("GUI\Menus\Menu")
BorderTexture1 = TextureManager.TextureRectangle(MainTexture, New Rectangle(0, 0, 48, 48), ContentPackManager.GetTextureResolution("GUI\Menus\Menu")) Texture = TextureManager.GetTexture(MainTexture, New Rectangle(0, 0, 48, 48), ContentPackManager.GetTextureResolution("GUI\Menus\Menu"))
BorderTexture2 = TextureManager.TextureRectangle(MainTexture, New Rectangle(0, 128, 48, 48), ContentPackManager.GetTextureResolution("GUI\Menus\Menu"))
BorderTexture3 = TextureManager.TextureRectangle(MainTexture, New Rectangle(48, 0, 48, 48), ContentPackManager.GetTextureResolution("GUI\Menus\Menu"))
BorderTexture4 = TextureManager.TextureRectangle(MainTexture, New Rectangle(48, 48, 48, 48), ContentPackManager.GetTextureResolution("GUI\Menus\Menu"))
BorderTexture5 = TextureManager.TextureRectangle(MainTexture, New Rectangle(0, 0, 48, 48), ContentPackManager.GetTextureResolution("GUI\Menus\Menu"))
Me.index = Player.Temp.PokemonScreenIndex Me.index = Player.Temp.PokemonScreenIndex
@ -179,8 +176,8 @@
Public Overrides Sub Draw() Public Overrides Sub Draw()
Me.PreScreen.Draw() Me.PreScreen.Draw()
Canvas.DrawImageBorder(BorderTexture1, 2, New Rectangle(60, 100, 800, 480)) Canvas.DrawImageBorder(Texture, 2, New Rectangle(60, 100, 800, 480))
Canvas.DrawImageBorder(BorderTexture1, 2, New Rectangle(60, 100, 480, 64)) Canvas.DrawImageBorder(Texture, 2, New Rectangle(60, 100, 480, 64))
Core.SpriteBatch.DrawString(FontManager.InGameFont, Me.Title, New Vector2(142, 132), Color.Black) Core.SpriteBatch.DrawString(FontManager.InGameFont, Me.Title, New Vector2(142, 132), Color.Black)
Core.SpriteBatch.Draw(Item.Texture, New Rectangle(78, 124, 48, 48), Color.White) Core.SpriteBatch.Draw(Item.Texture, New Rectangle(78, 124, 48, 48), Color.White)
@ -211,7 +208,6 @@
TextBox.Draw() TextBox.Draw()
End Sub End Sub
Dim BorderTexture1 As Texture2D
Private Sub DrawEmptyTile(ByVal i As Integer) Private Sub DrawEmptyTile(ByVal i As Integer)
Dim p As Vector2 Dim p As Vector2
Select Case i Select Case i
@ -224,33 +220,29 @@
p.Y += 180 p.Y += 180
With Core.SpriteBatch With Core.SpriteBatch
.Draw(BorderTexture1, New Rectangle(CInt(p.X), CInt(p.Y), 32, 96), New Rectangle(0, 0, 16, 48), Color.White) .Draw(Texture, New Rectangle(CInt(p.X), CInt(p.Y), 32, 96), New Rectangle(0, 0, 16, 48), Color.White)
For x = p.X + 32 To p.X + 288 Step 32 For x = p.X + 32 To p.X + 288 Step 32
.Draw(BorderTexture1, New Rectangle(CInt(x), CInt(p.Y), 32, 96), New Rectangle(16, 0, 16, 48), Color.White) .Draw(Texture, New Rectangle(CInt(x), CInt(p.Y), 32, 96), New Rectangle(16, 0, 16, 48), Color.White)
Next Next
.Draw(BorderTexture1, New Rectangle(CInt(p.X) + 320, CInt(p.Y), 32, 96), New Rectangle(32, 0, 16, 48), Color.White) .Draw(Texture, New Rectangle(CInt(p.X) + 320, CInt(p.Y), 32, 96), New Rectangle(32, 0, 16, 48), Color.White)
.DrawString(FontManager.MiniFont, "EMPTY", New Vector2(CInt(p.X + 72), CInt(p.Y + 18)), Color.Black) .DrawString(FontManager.MiniFont, "EMPTY", New Vector2(CInt(p.X + 72), CInt(p.Y + 18)), Color.Black)
End With End With
End Sub End Sub
Dim BorderTexture2 As Texture2D
Dim BorderTexture3 As Texture2D
Dim BorderTexture4 As Texture2D
Dim BorderTexture5 As Texture2D
Private Sub DrawPokemonTile(ByVal i As Integer, ByVal Pokemon As Pokemon) Private Sub DrawPokemonTile(ByVal i As Integer, ByVal Pokemon As Pokemon)
Dim BorderTexture As Texture2D Dim BorderTexture As Texture2D
If i = index Then If i = index Then
If Pokemon.Status = net.Pokemon3D.Game.Pokemon.StatusProblems.Fainted Then If Pokemon.Status = net.Pokemon3D.Game.Pokemon.StatusProblems.Fainted Then
BorderTexture = BorderTexture2 BorderTexture = TextureManager.GetTexture(MainTexture, New Rectangle(0, 128, 48, 48), ContentPackManager.GetTextureResolution("GUI\Menus\Menu"))
Else Else
BorderTexture = BorderTexture3 BorderTexture = TextureManager.GetTexture(MainTexture, New Rectangle(48, 0, 48, 48), ContentPackManager.GetTextureResolution("GUI\Menus\Menu"))
End If End If
Else Else
If Pokemon.Status = net.Pokemon3D.Game.Pokemon.StatusProblems.Fainted Then If Pokemon.Status = net.Pokemon3D.Game.Pokemon.StatusProblems.Fainted Then
BorderTexture = BorderTexture4 BorderTexture = TextureManager.GetTexture(MainTexture, New Rectangle(48, 48, 48, 48), ContentPackManager.GetTextureResolution("GUI\Menus\Menu"))
Else Else
BorderTexture = BorderTexture5 BorderTexture = TextureManager.GetTexture(MainTexture, New Rectangle(0, 0, 48, 48), ContentPackManager.GetTextureResolution("GUI\Menus\Menu"))
End If End If
End If End If
@ -358,21 +350,4 @@
Me.moveLearnArg = arg Me.moveLearnArg = arg
End Sub 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 End Class

View File

@ -11,6 +11,7 @@
Dim cItems As New Dictionary(Of Item, Integer) Dim cItems As New Dictionary(Of Item, Integer)
Dim mainTexture As Texture2D Dim mainTexture As Texture2D
Dim texture As Texture2D
Public Delegate Sub DoStuff(ByVal ItemID As Integer) Public Delegate Sub DoStuff(ByVal ItemID As Integer)
Dim ReturnItem As DoStuff Dim ReturnItem As DoStuff
@ -32,10 +33,7 @@
Me.Identification = Identifications.InventoryScreen Me.Identification = Identifications.InventoryScreen
Me.PreScreen = currentScreen Me.PreScreen = currentScreen
Me.mainTexture = TextureManager.GetTexture("GUI\Menus\Menu") Me.mainTexture = TextureManager.GetTexture("GUI\Menus\Menu")
texture1 = TextureManager.TextureRectangle(mainTexture, New Rectangle(0, 0, 48, 48)) Me.texture = TextureManager.GetTexture(mainTexture, New Rectangle(0, 0, 48, 48))
texture2 = TextureManager.TextureRectangle(mainTexture, New Rectangle(112, 12, 1, 1))
texture3 = TextureManager.TextureRectangle(mainTexture, New Rectangle(113, 12, 1, 1))
texture4 = TextureManager.TextureRectangle(mainTexture, New Rectangle(48, 0, 48, 48))
Me.ReturnItem = DoStuff Me.ReturnItem = DoStuff
Me.AllowedPages = AllowedPages Me.AllowedPages = AllowedPages
@ -233,20 +231,15 @@
ChangeBag() ChangeBag()
End Sub End Sub
Dim texture1 As Texture2D
Dim texture2 As Texture2D
Dim texture3 As Texture2D
Dim texture4 As Texture2D
Public Overrides Sub Draw() Public Overrides Sub Draw()
Me.PreScreen.Draw() Me.PreScreen.Draw()
Canvas.DrawImageBorder(texture1, 2, New Rectangle(60, 100, 800, 480)) Canvas.DrawImageBorder(texture, 2, New Rectangle(60, 100, 800, 480))
Canvas.DrawImageBorder(texture1, 2, New Rectangle(572, 100, 288, 64)) Canvas.DrawImageBorder(texture, 2, New Rectangle(572, 100, 288, 64))
Canvas.DrawImageBorder(texture1, 2, New Rectangle(60, 516, 480, 64)) Canvas.DrawImageBorder(texture, 2, New Rectangle(60, 516, 480, 64))
Canvas.DrawImageBorder(texture1, 2, New Rectangle(572, 196, 288, 384)) Canvas.DrawImageBorder(texture, 2, New Rectangle(572, 196, 288, 384))
Canvas.DrawImageBorder(texture1, 2, New Rectangle(620, 420, 192, 64)) Canvas.DrawImageBorder(texture, 2, New Rectangle(620, 420, 192, 64))
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\BagPack"), New Rectangle(592, 126, 48, 48), New Rectangle(24 * bagIndex, 150, 24, 24), Color.White) Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\BagPack"), New Rectangle(592, 126, 48, 48), New Rectangle(24 * bagIndex, 150, 24, 24), Color.White)
@ -254,7 +247,7 @@
Core.SpriteBatch.DrawString(FontManager.MiniFont, Localization.GetString("inventory_menu_backadvice"), New Vector2(1200 - FontManager.MiniFont.MeasureString(Localization.GetString("inventory_menu_backadvice")).X - 330, 580), Color.DarkGray) Core.SpriteBatch.DrawString(FontManager.MiniFont, Localization.GetString("inventory_menu_backadvice"), New Vector2(1200 - FontManager.MiniFont.MeasureString(Localization.GetString("inventory_menu_backadvice")).X - 330, 580), Color.DarkGray)
Core.SpriteBatch.DrawString(FontManager.MainFont, Localization.GetString("inventory_menu_items") & ":" & vbNewLine & Localization.GetString("item_category_" & Me.bagIdentifier.ToString()), New Vector2(640, 446), Color.Black) Core.SpriteBatch.DrawString(FontManager.MainFont, Localization.GetString("inventory_menu_items") & ":" & vbNewLine & Localization.GetString("item_category_" & Me.bagIdentifier.ToString()), New Vector2(640, 446), Color.Black)
Canvas.DrawScrollBar(New Vector2(555, 120), cItems.Count, 6, scrollIndex(bagIndex), New Size(4, 390), False, texture2, texture3) Canvas.DrawScrollBar(New Vector2(555, 120), cItems.Count, 6, scrollIndex(bagIndex), New Size(4, 390), False, TextureManager.GetTexture(mainTexture, New Rectangle(112, 12, 1, 1)), TextureManager.GetTexture(mainTexture, New Rectangle(113, 12, 1, 1)))
For i As Integer = 0 To cItems.Keys.Count - 1 For i As Integer = 0 To cItems.Keys.Count - 1
Dim Item As Item = cItems.Keys(i) Dim Item As Item = cItems.Keys(i)
@ -264,9 +257,9 @@
Dim BorderTexture As Texture2D Dim BorderTexture As Texture2D
If i = index(bagIndex) Then If i = index(bagIndex) Then
BorderTexture = texture4 BorderTexture = TextureManager.GetTexture(mainTexture, New Rectangle(48, 0, 48, 48))
Else Else
BorderTexture = texture1 BorderTexture = texture
End If End If
Canvas.DrawImageBorder(BorderTexture, 1, New Rectangle(CInt(p.X), CInt(p.Y + (i + scrollIndex(bagIndex)) * 70), 320, 32)) Canvas.DrawImageBorder(BorderTexture, 1, New Rectangle(CInt(p.X), CInt(p.Y + (i + scrollIndex(bagIndex)) * 70), 320, 32))
@ -314,7 +307,7 @@
Core.SpriteBatch.DrawString(FontManager.MiniFont, "Sortmode: """ & displayMode & """", New Vector2(638, 522), Color.Gray) Core.SpriteBatch.DrawString(FontManager.MiniFont, "Sortmode: """ & displayMode & """", New Vector2(638, 522), Color.Gray)
End If End If
Canvas.DrawScrollBar(New Vector2(630, 405), 8, 1, bagIndex, New Size(200, 4), True, texture2, texture3) Canvas.DrawScrollBar(New Vector2(630, 405), 8, 1, bagIndex, New Size(200, 4), True, TextureManager.GetTexture(mainTexture, New Rectangle(112, 12, 1, 1)), TextureManager.GetTexture(mainTexture, New Rectangle(113, 12, 1, 1)))
End Sub End Sub
Public Overrides Sub ChangeTo() Public Overrides Sub ChangeTo()
@ -326,18 +319,4 @@
ChangeBag() ChangeBag()
End Sub 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 End Class

View File

@ -19,8 +19,6 @@
Me.canUse = canUse Me.canUse = canUse
Me.mainTexture = TextureManager.GetTexture("GUI\Menus\Menu") Me.mainTexture = TextureManager.GetTexture("GUI\Menus\Menu")
CanvasTexture1 = TextureManager.TextureRectangle(mainTexture, New Rectangle(0, 0, 48, 48))
CanvasTexture2 = TextureManager.TextureRectangle(mainTexture, New Rectangle(0, 48, 48, 48))
End Sub End Sub
Public Overrides Sub Draw() Public Overrides Sub Draw()
@ -36,10 +34,8 @@
TextBox.Draw() TextBox.Draw()
End Sub End Sub
Dim CanvasTexture1 As Texture2D
Dim CanvasTexture2 As Texture2D
Private Sub DrawItem() Private Sub DrawItem()
Canvas.DrawImageBorder(CanvasTexture1, 2, New Rectangle(CInt(Core.windowSize.Width / 2) - 84, 64, 128, 128)) Canvas.DrawImageBorder(TextureManager.GetTexture(mainTexture, New Rectangle(0, 0, 48, 48)), 2, New Rectangle(CInt(Core.windowSize.Width / 2) - 84, 64, 128, 128))
Core.SpriteBatch.Draw(Item.Texture, New Rectangle(CInt(Core.windowSize.Width / 2) - 56, 96, 96, 96), Color.White) Core.SpriteBatch.Draw(Item.Texture, New Rectangle(CInt(Core.windowSize.Width / 2) - 56, 96, 96, 96), Color.White)
End Sub End Sub
@ -51,9 +47,9 @@
Dim Text As String = MenuItems(i) Dim Text As String = MenuItems(i)
If i = index Then If i = index Then
CanvasTexture = CanvasTexture2 CanvasTexture = TextureManager.GetTexture(mainTexture, New Rectangle(0, 48, 48, 48))
Else Else
CanvasTexture = CanvasTexture1 CanvasTexture = TextureManager.GetTexture(mainTexture, New Rectangle(0, 0, 48, 48))
End If End If
Dim offSetX As Integer = 0 Dim offSetX As Integer = 0
@ -197,13 +193,4 @@
End If End If
MenuItems.Add(Localization.GetString("item_detail_screen_back")) MenuItems.Add(Localization.GetString("item_detail_screen_back"))
End Sub 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 End Class

View File

@ -78,10 +78,6 @@
GameJolt.Emblem.ClearOnlineSpriteCache() GameJolt.Emblem.ClearOnlineSpriteCache()
Screen.Level.World.Initialize(Screen.Level.EnvironmentType, Screen.Level.WeatherType) Screen.Level.World.Initialize(Screen.Level.EnvironmentType, Screen.Level.WeatherType)
texture1 = TextureManager.GetTexture("GUI\Logos\P3D")
texture2 = TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(0, 48, 48, 48), "")
texture3 = TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(48, 0, 48, 48), "")
texture4 = TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(0, 0, 48, 48), "")
End Sub End Sub
Private Sub GetPacks(Optional ByVal reload As Boolean = False) Private Sub GetPacks(Optional ByVal reload As Boolean = False)
@ -269,11 +265,6 @@
#Region "MainMenu" #Region "MainMenu"
Dim texture1 As Texture2D
Dim texture2 As Texture2D
Dim texture3 As Texture2D
Dim texture4 As Texture2D
Public Overrides Sub Draw() Public Overrides Sub Draw()
'Core.GraphicsDevice.SetRenderTarget(renderTarget) 'Core.GraphicsDevice.SetRenderTarget(renderTarget)
@ -317,7 +308,7 @@
End Select End Select
Core.SpriteBatch.DrawInterfaceString(FontManager.InGameFont, GameController.DEVELOPER_NAME, New Vector2(7, Core.ScreenSize.Height - FontManager.InGameFont.MeasureString(GameController.DEVELOPER_NAME).Y - 1), Color.Black) Core.SpriteBatch.DrawInterfaceString(FontManager.InGameFont, GameController.DEVELOPER_NAME, New Vector2(7, Core.ScreenSize.Height - FontManager.InGameFont.MeasureString(GameController.DEVELOPER_NAME).Y - 1), Color.Black)
Core.SpriteBatch.DrawInterfaceString(FontManager.InGameFont, GameController.DEVELOPER_NAME, New Vector2(4, Core.ScreenSize.Height - FontManager.InGameFont.MeasureString(GameController.DEVELOPER_NAME).Y - 4), Color.White) Core.SpriteBatch.DrawInterfaceString(FontManager.InGameFont, GameController.DEVELOPER_NAME, New Vector2(4, Core.ScreenSize.Height - FontManager.InGameFont.MeasureString(GameController.DEVELOPER_NAME).Y - 4), Color.White)
Core.SpriteBatch.DrawInterface(texture1, New Rectangle(CInt(Core.ScreenSize.Width / 2) - 260, 40, 500, 110), Color.White) Core.SpriteBatch.DrawInterface(TextureManager.GetTexture("GUI\Logos\P3D"), New Rectangle(CInt(Core.ScreenSize.Width / 2) - 260, 40, 500, 110), Color.White)
If Core.GameOptions.ShowDebug = 0 Then If Core.GameOptions.ShowDebug = 0 Then
Dim s As String = GameController.GAMENAME & " " & GameController.GAMEDEVELOPMENTSTAGE & " " & GameController.GAMEVERSION Dim s As String = GameController.GAMENAME & " " & GameController.GAMEDEVELOPMENTSTAGE & " " & GameController.GAMEVERSION
@ -345,12 +336,12 @@
End Select End Select
If i = mainmenuIndex Then If i = mainmenuIndex Then
CanvasTexture = texture2 CanvasTexture = TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(0, 48, 48, 48), "")
Else Else
If i < 2 And Saves.Count = 0 Or i = 0 And System.IO.Directory.Exists(GameController.GamePath & "\Save\autosave") = False Then If i < 2 And Saves.Count = 0 Or i = 0 And System.IO.Directory.Exists(GameController.GamePath & "\Save\autosave") = False Then
CanvasTexture = texture3 CanvasTexture = TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(48, 0, 48, 48), "")
Else Else
CanvasTexture = texture4 CanvasTexture = TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(0, 0, 48, 48), "")
End If End If
End If End If

View File

@ -21,8 +21,6 @@
End If End If
Me.mainTexture = TextureManager.GetTexture("GUI\Menus\Menu") Me.mainTexture = TextureManager.GetTexture("GUI\Menus\Menu")
Me.CanvasTexture1 = TextureManager.TextureRectangle(mainTexture, New Rectangle(0, 48, 48, 48))
Me.CanvasTexture2 = TextureManager.TextureRectangle(mainTexture, New Rectangle(0, 0, 48, 48))
If Core.Player.IsGamejoltSave = True Then If Core.Player.IsGamejoltSave = True Then
Me.canCreateAutosave = False Me.canCreateAutosave = False
@ -89,8 +87,6 @@
#Region "MainMenu" #Region "MainMenu"
Dim CanvasTexture1 As Texture2D
Dim CanvasTexture2 As Texture2D
Private Sub DrawMenu() Private Sub DrawMenu()
For i = 0 To 1 For i = 0 To 1
Dim Text As String = "" Dim Text As String = ""
@ -102,9 +98,9 @@
End Select End Select
If i = mainIndex Then If i = mainIndex Then
Canvas.DrawImageBorder(CanvasTexture1, 2, New Rectangle(CInt(Core.ScreenSize.Width / 2) - 180, 220 + i * 128, 320, 64), True) Canvas.DrawImageBorder(TextureManager.GetTexture(mainTexture, New Rectangle(0, 48, 48, 48)), 2, New Rectangle(CInt(Core.ScreenSize.Width / 2) - 180, 220 + i * 128, 320, 64), True)
Else Else
Canvas.DrawImageBorder(CanvasTexture2, 2, New Rectangle(CInt(Core.ScreenSize.Width / 2) - 180, 220 + i * 128, 320, 64), True) Canvas.DrawImageBorder(TextureManager.GetTexture(mainTexture, New Rectangle(0, 0, 48, 48)), 2, New Rectangle(CInt(Core.ScreenSize.Width / 2) - 180, 220 + i * 128, 320, 64), True)
End If End If
Core.SpriteBatch.DrawInterfaceString(FontManager.InGameFont, Text, New Vector2(CInt(Core.ScreenSize.Width / 2) - (FontManager.InGameFont.MeasureString(Text).X / 2) - 10, 256 + i * 128), Color.Black) Core.SpriteBatch.DrawInterfaceString(FontManager.InGameFont, Text, New Vector2(CInt(Core.ScreenSize.Width / 2) - (FontManager.InGameFont.MeasureString(Text).X / 2) - 10, 256 + i * 128), Color.Black)
@ -191,9 +187,9 @@
End Select End Select
If i = quitIndex Then If i = quitIndex Then
Canvas.DrawImageBorder(CanvasTexture1, 2, New Rectangle(CInt(Core.ScreenSize.Width / 2) - 180 + x, 320, 320, 64), True) Canvas.DrawImageBorder(TextureManager.GetTexture(mainTexture, New Rectangle(0, 48, 48, 48)), 2, New Rectangle(CInt(Core.ScreenSize.Width / 2) - 180 + x, 320, 320, 64), True)
Else Else
Canvas.DrawImageBorder(CanvasTexture2, 2, New Rectangle(CInt(Core.ScreenSize.Width / 2) - 180 + x, 320, 320, 64), True) Canvas.DrawImageBorder(TextureManager.GetTexture(mainTexture, New Rectangle(0, 0, 48, 48)), 2, New Rectangle(CInt(Core.ScreenSize.Width / 2) - 180 + x, 320, 320, 64), True)
End If End If
Core.SpriteBatch.DrawInterfaceString(FontManager.InGameFont, Text, New Vector2(CInt(Core.ScreenSize.Width / 2) - (FontManager.InGameFont.MeasureString(Text).X / 2) - 10 + x, 356), Color.Black) Core.SpriteBatch.DrawInterfaceString(FontManager.InGameFont, Text, New Vector2(CInt(Core.ScreenSize.Width / 2) - (FontManager.InGameFont.MeasureString(Text).X / 2) - 10 + x, 356), Color.Black)
@ -278,13 +274,4 @@
MusicManager.MasterVolume *= 4 MusicManager.MasterVolume *= 4
MusicManager.ForceVolumeUpdate() MusicManager.ForceVolumeUpdate()
End Sub 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 End Class

View File

@ -428,10 +428,7 @@
c = Color.Gray c = Color.Gray
End If End If
' Plz Fix It Aragaz Plz Core.SpriteBatch.Draw(Route.getTexture(objectsTexture, isSelected), Route.getRectangle(mapOffset), c)
Dim texture = Route.getTexture(objectsTexture, isSelected)
Core.SpriteBatch.Draw(texture, Route.getRectangle(mapOffset), c)
texture.Dispose()
Next Next
End If End If
@ -447,10 +444,7 @@
c = Color.Gray c = Color.Gray
End If End If
' Plz Fix It Aragaz Plz Core.SpriteBatch.Draw(City.getTexture(objectsTexture, isSelected), City.getRectangle(mapOffset), c)
Dim texture = City.getTexture(objectsTexture, isSelected)
Core.SpriteBatch.Draw(texture, City.getRectangle(mapOffset), c)
texture.Dispose()
Next Next
End If End If
@ -466,18 +460,13 @@
c = Color.Gray c = Color.Gray
End If End If
' Plz Fix It Aragaz Plz Core.SpriteBatch.Draw(Place.getTexture(objectsTexture, isSelected), Place.getRectangle(mapOffset), c)
Dim texture = Place.getTexture(objectsTexture, isSelected)
Core.SpriteBatch.Draw(texture, Place.getRectangle(mapOffset), c)
texture.Dispose()
Next Next
End If End If
If drawObjects(3) = True Then If drawObjects(3) = True Then
For Each Pokes As Roaming In RoamingPoke For Each Pokes As Roaming In RoamingPoke
Dim text = Pokes.getTexture() Core.SpriteBatch.Draw(Pokes.getTexture(), Pokes.getRectangle(mapOffset), Color.White)
Core.SpriteBatch.Draw(text, Pokes.getRectangle(mapOffset), Color.White)
text.Dispose()
Next Next
End If End If
@ -714,7 +703,6 @@
Return New Rectangle(CInt(Me.getPosition().X + offset.X), CInt(Me.getPosition().Y + offset.Y), sizeX, sizeY) Return New Rectangle(CInt(Me.getPosition().X + offset.X), CInt(Me.getPosition().Y + offset.Y), sizeX, sizeY)
End Function End Function
' It will leak
Public Function getTexture(ByVal FullTexture As Texture2D, ByVal isSelected As Boolean) As Texture2D Public Function getTexture(ByVal FullTexture As Texture2D, ByVal isSelected As Boolean) As Texture2D
If Me.T Is Nothing Or isSelected = True Then If Me.T Is Nothing Or isSelected = True Then
Dim r As Rectangle Dim r As Rectangle
@ -736,7 +724,7 @@
Case CitySize.Large Case CitySize.Large
r = New Rectangle(0 + modX, 36, 36, 24) r = New Rectangle(0 + modX, 36, 36, 24)
End Select End Select
Me.T = TextureManager.TextureRectangle(FullTexture, r) Me.T = TextureManager.GetTexture(FullTexture, r)
End If End If
Return Me.T Return Me.T
@ -866,8 +854,7 @@
Return New Rectangle(CInt(Me.getPosition().X + PositionOffset.X + offset.X), CInt(Me.getPosition().Y + PositionOffset.Y + offset.Y), CInt(sizeX), CInt(sizeY)) Return New Rectangle(CInt(Me.getPosition().X + PositionOffset.X + offset.X), CInt(Me.getPosition().Y + PositionOffset.Y + offset.Y), CInt(sizeX), CInt(sizeY))
End Function End Function
'It will leak Public Function getTexture(ByVal FullTexture As Texture2D, ByVal isSelected As Boolean) As Texture2D
Public Function getTexture(ByVal FullTexture As Texture2D, ByVal isSelected As Boolean) As Texture2D
If Me.T Is Nothing Or isSelected = True Then If Me.T Is Nothing Or isSelected = True Then
Dim r As Rectangle Dim r As Rectangle
@ -911,7 +898,7 @@
r = New Rectangle(16 + modX, 16 + y, 8, 8) r = New Rectangle(16 + modX, 16 + y, 8, 8)
End Select End Select
Me.T = TextureManager.TextureRectangle(FullTexture, r) Me.T = TextureManager.GetTexture(FullTexture, r)
End If End If
Return Me.T Return Me.T
@ -1016,7 +1003,6 @@
Return New Rectangle(CInt(Me.getPosition().X + PositionOffset.X + offset.X), CInt(Me.getPosition().Y + PositionOffset.Y + offset.Y), CInt(sizeX), CInt(sizeY)) Return New Rectangle(CInt(Me.getPosition().X + PositionOffset.X + offset.X), CInt(Me.getPosition().Y + PositionOffset.Y + offset.Y), CInt(sizeX), CInt(sizeY))
End Function End Function
'It will leak
Public Function getTexture(ByVal FullTexture As Texture2D, ByVal isSelected As Boolean) As Texture2D Public Function getTexture(ByVal FullTexture As Texture2D, ByVal isSelected As Boolean) As Texture2D
If Me.T Is Nothing Or isSelected = True Then If Me.T Is Nothing Or isSelected = True Then
Dim r As Rectangle Dim r As Rectangle
@ -1041,7 +1027,7 @@
Case PlaceSizes.Large Case PlaceSizes.Large
r = New Rectangle(12 + modX, 0 + y, 28, 20) r = New Rectangle(12 + modX, 0 + y, 28, 20)
End Select End Select
Me.T = TextureManager.TextureRectangle(FullTexture, r) Me.T = TextureManager.GetTexture(FullTexture, r)
End If End If
Return Me.T Return Me.T
@ -1113,7 +1099,7 @@
IndexY = CInt(Math.Floor(ID / 33)) IndexY = CInt(Math.Floor(ID / 33))
IndexX = (ID - (IndexY * 32)) - 1 IndexX = (ID - (IndexY * 32)) - 1
T = TextureManager.TextureRectangle(Texture, New Rectangle(IndexX * 32, IndexY * 32, SizeX, SizeY)) T = TextureManager.GetTexture(Texture, New Rectangle(IndexX * 32, IndexY * 32, SizeX, SizeY))
Return T Return T
End Function End Function

View File

@ -78,10 +78,7 @@
TextBox.Showing = False TextBox.Showing = False
Me.Index = 0 Me.Index = 0
TextBox.reDelay = 0 TextBox.reDelay = 0
skinTexture = TextureManager.TextureRectangle(TextureManager.GetTexture("Textures\NPC\" & startSkins(SkinIndex)), New Rectangle(0, 64, 32, 32)) skinTexture = TextureManager.GetTexture(TextureManager.GetTexture("Textures\NPC\" & startSkins(SkinIndex)), New Rectangle(0, 64, 32, 32))
texture0 = TextureManager.GetTexture("GUI\Menus\Menu")
texture1 = TextureManager.TextureRectangle(texture0, New Rectangle(112, 12, 1, 1))
texture2 = TextureManager.TextureRectangle(texture0, New Rectangle(113, 12, 1, 1))
MusicManager.PlayMusic("nomusic") MusicManager.PlayMusic("nomusic")
End Sub End Sub
@ -209,9 +206,6 @@
Index += 1 Index += 1
End Sub End Sub
Dim texture0 As Texture2D
Dim texture1 As Texture2D
Dim texture2 As Texture2D
Public Overrides Sub Draw() Public Overrides Sub Draw()
Canvas.DrawRectangle(New Rectangle(0, 0, Core.windowSize.Width, Core.windowSize.Height), currentBackColor) Canvas.DrawRectangle(New Rectangle(0, 0, Core.windowSize.Width, Core.windowSize.Height), currentBackColor)
@ -245,7 +239,7 @@
Core.SpriteBatch.DrawString(FontManager.MiniFont, Localization.GetString("new_game_choose_skin") & ":" & vbNewLine & skinNames(SkinIndex), New Vector2(TextboxPosition.X, TextboxPosition.Y - 24), Color.White) Core.SpriteBatch.DrawString(FontManager.MiniFont, Localization.GetString("new_game_choose_skin") & ":" & vbNewLine & skinNames(SkinIndex), New Vector2(TextboxPosition.X, TextboxPosition.Y - 24), Color.White)
Canvas.DrawScrollBar(New Vector2(TextboxPosition.X, TextboxPosition.Y + 48), startSkins.Count, 1, SkinIndex, New Size(128, 4), True, texture1, texture2) Canvas.DrawScrollBar(New Vector2(TextboxPosition.X, TextboxPosition.Y + 48), startSkins.Count, 1, SkinIndex, New Size(128, 4), True, TextureManager.GetTexture(TextureManager.GetTexture("GUI\Menus\Menu"), New Rectangle(112, 12, 1, 1)), TextureManager.GetTexture(TextureManager.GetTexture("GUI\Menus\Menu"), New Rectangle(113, 12, 1, 1)))
End Select End Select
End Sub End Sub
@ -355,7 +349,7 @@
SkinIndex = CInt(MathHelper.Clamp(SkinIndex, 0, startSkins.Count - 1)) SkinIndex = CInt(MathHelper.Clamp(SkinIndex, 0, startSkins.Count - 1))
If sIndex <> SkinIndex Then If sIndex <> SkinIndex Then
skinTexture = TextureManager.TextureRectangle(TextureManager.GetTexture("Textures\NPC\" & startSkins(SkinIndex)), New Rectangle(0, 64, 32, 32)) skinTexture = TextureManager.GetTexture(TextureManager.GetTexture("Textures\NPC\" & startSkins(SkinIndex)), New Rectangle(0, 64, 32, 32))
End If End If
If Controls.Accept() = True Then If Controls.Accept() = True Then
@ -367,11 +361,7 @@
CanMuteMusic = False CanMuteMusic = False
If ControllerHandler.ButtonPressed(Buttons.X) = True Then If ControllerHandler.ButtonPressed(Buttons.X) = True Then
'It will leak Core.SetScreen(New InputScreen(Core.CurrentScreen, "Player", InputScreen.InputModes.Name, Me.CurrentText, 14, {TextureManager.GetTexture(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)
@ -556,16 +546,4 @@
Return Localization.GetString("new_game_oak_name_1") & name & Localization.GetString("new_game_oak_name_2") Return Localization.GetString("new_game_oak_name_1") & name & Localization.GetString("new_game_oak_name_2")
End Function End Function
Protected Overrides Sub Finalize()
If texture1 IsNot Nothing
texture1.Dispose()
End If
If texture2 IsNot Nothing
texture2.Dispose()
End If
If skinTexture IsNot Nothing
skinTexture.Dispose()
End If
End Sub
End Class End Class

View File

@ -63,16 +63,12 @@
Me.PreferMultiSampling = Core.GraphicsManager.PreferMultiSampling Me.PreferMultiSampling = Core.GraphicsManager.PreferMultiSampling
InitializeControls() InitializeControls()
texture1 = TextureManager.TextureRectangle(TextureManager.GetTexture("GUI\Menus\Menu"), New Rectangle(0, 0, 48, 48))
End Sub End Sub
Dim texture1 As Texture2D
Public Overrides Sub Draw() Public Overrides Sub Draw()
Me.PreScreen.Draw() Me.PreScreen.Draw()
Canvas.DrawImageBorder(texture1, 2, New Rectangle(60, 100, 800, 480)) Canvas.DrawImageBorder(TextureManager.GetTexture(TextureManager.GetTexture("GUI\Menus\Menu"), New Rectangle(0, 0, 48, 48)), 2, New Rectangle(60, 100, 800, 480))
Core.SpriteBatch.DrawString(FontManager.InGameFont, Me.CurrentPath, New Vector2(80, 130), Color.Black) Core.SpriteBatch.DrawString(FontManager.InGameFont, Me.CurrentPath, New Vector2(80, 130), Color.Black)
If savedOptions = False Then If savedOptions = False Then
@ -487,9 +483,6 @@
Public Sub New(ByVal TriggerSub As OnToggle) Public Sub New(ByVal TriggerSub As OnToggle)
Me.OnToggleTrigger = TriggerSub Me.OnToggleTrigger = TriggerSub
texture1 = TextureManager.TextureRectangle(TextureManager.GetTexture("GUI\Menus\Menu"), New Rectangle(0, 48, 48, 48))
texture2 = TextureManager.TextureRectangle(TextureManager.GetTexture("GUI\Menus\Menu"), New Rectangle(0, 0, 48, 48))
End Sub End Sub
Public Sub New(ByVal Position As Vector2, ByVal Size As Integer, ByVal Text As String, ByVal Toggled As Boolean, ByVal TriggerSub As OnToggle) Public Sub New(ByVal Position As Vector2, ByVal Size As Integer, ByVal Text As String, ByVal Toggled As Boolean, ByVal TriggerSub As OnToggle)
@ -503,19 +496,14 @@
Me._toggled = Toggled Me._toggled = Toggled
Me.OnToggleTrigger = TriggerSub Me.OnToggleTrigger = TriggerSub
Me.Settings = Settings Me.Settings = Settings
texture1 = TextureManager.TextureRectangle(TextureManager.GetTexture("GUI\Menus\Menu"), New Rectangle(0, 48, 48, 48))
texture2 = TextureManager.TextureRectangle(TextureManager.GetTexture("GUI\Menus\Menu"), New Rectangle(0, 0, 48, 48))
End Sub End Sub
Dim texture1 As Texture2D
Dim texture2 As Texture2D
Public Overrides Sub Draw() Public Overrides Sub Draw()
If _toggled = True Then If _toggled = True Then
Canvas.DrawImageBorder(texture1, 2, New Rectangle(CInt(_position.X), CInt(_position.Y) + YScroll, 32 * _size, 64)) Canvas.DrawImageBorder(TextureManager.GetTexture(TextureManager.GetTexture("GUI\Menus\Menu"), New Rectangle(0, 48, 48, 48)), 2, New Rectangle(CInt(_position.X), CInt(_position.Y) + YScroll, 32 * _size, 64))
Else Else
Canvas.DrawImageBorder(texture2, 2, New Rectangle(CInt(_position.X), CInt(_position.Y) + YScroll, 32 * _size, 64)) Canvas.DrawImageBorder(TextureManager.GetTexture(TextureManager.GetTexture("GUI\Menus\Menu"), New Rectangle(0, 0, 48, 48)), 2, New Rectangle(CInt(_position.X), CInt(_position.Y) + YScroll, 32 * _size, 64))
End If End If
Dim t As String = Me.Text Dim t As String = Me.Text
@ -540,15 +528,6 @@
End If End If
End If End If
End Sub 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 End Class
Class CommandButton Class CommandButton
@ -591,9 +570,6 @@
Public Sub New(ByVal ClickSub As OnClick) Public Sub New(ByVal ClickSub As OnClick)
Me.OnClickTrigger = ClickSub Me.OnClickTrigger = ClickSub
texture1 = TextureManager.TextureRectangle(TextureManager.GetTexture("GUI\Menus\Menu"), New Rectangle(48, 0, 48, 48))
texture2 = TextureManager.TextureRectangle(TextureManager.GetTexture("GUI\Menus\Menu"), New Rectangle(0, 0, 48, 48))
End Sub End Sub
Public Sub New(ByVal Position As Vector2, ByVal Size As Integer, ByVal Text As String, ByVal ClickSub As OnClick) Public Sub New(ByVal Position As Vector2, ByVal Size As Integer, ByVal Text As String, ByVal ClickSub As OnClick)
@ -601,20 +577,15 @@
Me._size = Size Me._size = Size
Me._text = Text Me._text = Text
Me.OnClickTrigger = ClickSub Me.OnClickTrigger = ClickSub
texture1 = TextureManager.TextureRectangle(TextureManager.GetTexture("GUI\Menus\Menu"), New Rectangle(48, 0, 48, 48))
texture2 = TextureManager.TextureRectangle(TextureManager.GetTexture("GUI\Menus\Menu"), New Rectangle(0, 0, 48, 48))
End Sub End Sub
Dim texture1 As Texture2D
Dim texture2 As Texture2D
Public Overrides Sub Draw() Public Overrides Sub Draw()
Dim r As New Rectangle(CInt(_position.X), CInt(_position.Y) + YScroll, Me._size * 32 + 32, 96) Dim r As New Rectangle(CInt(_position.X), CInt(_position.Y) + YScroll, Me._size * 32 + 32, 96)
If r.Contains(MouseHandler.MousePosition) = True Then If r.Contains(MouseHandler.MousePosition) = True Then
Canvas.DrawImageBorder(texture1, 2, New Rectangle(CInt(_position.X), CInt(_position.Y) + YScroll, 32 * _size, 64)) Canvas.DrawImageBorder(TextureManager.GetTexture(TextureManager.GetTexture("GUI\Menus\Menu"), New Rectangle(48, 0, 48, 48)), 2, New Rectangle(CInt(_position.X), CInt(_position.Y) + YScroll, 32 * _size, 64))
Else Else
Canvas.DrawImageBorder(texture2, 2, New Rectangle(CInt(_position.X), CInt(_position.Y) + YScroll, 32 * _size, 64)) Canvas.DrawImageBorder(TextureManager.GetTexture(TextureManager.GetTexture("GUI\Menus\Menu"), New Rectangle(0, 0, 48, 48)), 2, New Rectangle(CInt(_position.X), CInt(_position.Y) + YScroll, 32 * _size, 64))
End If End If
Core.SpriteBatch.DrawString(FontManager.InGameFont, Me._text, New Vector2(CInt(_position.X) + CInt(((Me._size * 32 + 20) / 2) - (FontManager.InGameFont.MeasureString(Me._text).X / 2)), CInt(_position.Y) + 32 + YScroll), Color.Black) Core.SpriteBatch.DrawString(FontManager.InGameFont, Me._text, New Vector2(CInt(_position.X) + CInt(((Me._size * 32 + 20) / 2) - (FontManager.InGameFont.MeasureString(Me._text).X / 2)), CInt(_position.Y) + 32 + YScroll), Color.Black)
@ -629,15 +600,6 @@
End If End If
End If End If
End Sub 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 End Class
Class ScrollBar Class ScrollBar
@ -818,10 +780,4 @@
End Class End Class
#End Region #End Region
Protected Overrides Sub Finalize()
If texture1 IsNot Nothing
texture1.Dispose()
End If
End Sub
End Class End Class

View File

@ -48,7 +48,6 @@
LearnedMove = False LearnedMove = False
Me.mainTexture = TextureManager.GetTexture("GUI\Menus\Menu") Me.mainTexture = TextureManager.GetTexture("GUI\Menus\Menu")
texture1 = TextureManager.TextureRectangle(mainTexture, New Rectangle(0, 0, 48, 48))
End Sub End Sub
Public Sub New(ByVal currentScreen As Screen, ByVal PokemonIndex As Integer, ByVal MovesList() As BattleSystem.Attack) Public Sub New(ByVal currentScreen As Screen, ByVal PokemonIndex As Integer, ByVal MovesList() As BattleSystem.Attack)
@ -107,10 +106,9 @@
Me.mainTexture = TextureManager.GetTexture("GUI\Menus\Menu") Me.mainTexture = TextureManager.GetTexture("GUI\Menus\Menu")
End Sub End Sub
Dim texture1 As Texture2D
Public Overrides Sub Draw() Public Overrides Sub Draw()
Me.PreScreen.Draw() Me.PreScreen.Draw()
Canvas.DrawImageBorder(texture1, 2, New Rectangle(60, 100, 800, 480)) Canvas.DrawImageBorder(TextureManager.GetTexture(mainTexture, New Rectangle(0, 0, 48, 48)), 2, New Rectangle(60, 100, 800, 480))
Core.SpriteBatch.Draw(Pokemon.GetTexture(True), New Rectangle(80, 100, 128, 128), Color.White) Core.SpriteBatch.Draw(Pokemon.GetTexture(True), New Rectangle(80, 100, 128, 128), Color.White)
@ -216,9 +214,4 @@
End If End If
End Sub End Sub
Protected Overrides Sub Finalize()
If texture1 IsNot Nothing
texture1.Dispose()
End If
End Sub
End Class End Class

View File

@ -15,13 +15,11 @@
Me.PreScreen = currentScreen Me.PreScreen = currentScreen
Me.mainTexture = TextureManager.GetTexture("GUI\Menus\Menu") Me.mainTexture = TextureManager.GetTexture("GUI\Menus\Menu")
CanvasTexture1 = TextureManager.TextureRectangle(mainTexture, New Rectangle(0, 0, 48, 48))
ChooseBox.Show({Localization.GetString("save_screen_yes"), Localization.GetString("save_screen_no")}, 0, {}) ChooseBox.Show({Localization.GetString("save_screen_yes"), Localization.GetString("save_screen_no")}, 0, {})
SaveGameHelpers.ResetSaveCounter() SaveGameHelpers.ResetSaveCounter()
End Sub End Sub
Dim CanvasTexture1 As Texture2D
Public Overrides Sub Draw() Public Overrides Sub Draw()
Me.PreScreen.Draw() Me.PreScreen.Draw()
@ -29,7 +27,7 @@
GameJolt.Emblem.Draw(GameJolt.API.username, Core.GameJoltSave.GameJoltID, Core.GameJoltSave.Points, Core.GameJoltSave.Gender, Core.GameJoltSave.Emblem, New Vector2(CSng(Core.windowSize.Width / 2 - 256), 30), 4, Core.GameJoltSave.DownloadedSprite) GameJolt.Emblem.Draw(GameJolt.API.username, Core.GameJoltSave.GameJoltID, Core.GameJoltSave.Points, Core.GameJoltSave.Gender, Core.GameJoltSave.Emblem, New Vector2(CSng(Core.windowSize.Width / 2 - 256), 30), 4, Core.GameJoltSave.DownloadedSprite)
End If End If
Canvas.DrawImageBorder(CanvasTexture1, 2, New Rectangle(168, 168, 640, 320)) Canvas.DrawImageBorder(TextureManager.GetTexture(mainTexture, New Rectangle(0, 0, 48, 48)), 2, New Rectangle(168, 168, 640, 320))
With Core.SpriteBatch With Core.SpriteBatch
If saveSessionFailed = True Then If saveSessionFailed = True Then
@ -126,10 +124,4 @@
End If End If
End If End If
End Sub End Sub
Protected Overrides Sub Finalize()
If CanvasTexture1 IsNot Nothing
CanvasTexture1.Dispose()
End If
End Sub
End Class End Class

View File

@ -439,9 +439,7 @@ 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
Dim texture As Texture2D = GetItemTypeTexture(Me.loadedBuyCategories(i)) DrawButton(New Vector2(100, 100 + p * 96), 5, Me.loadedBuyCategories(i).ToString(), 16, 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
@ -851,9 +849,7 @@ 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
Dim texture As Texture2D = GetItemTypeTexture(Me.loadedSellCategories(i)) DrawButton(New Vector2(100, 100 + p * 96), 5, Me.loadedSellCategories(i).ToString(), 16, 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
@ -1224,7 +1220,6 @@ Public Class TradeScreen
Core.SpriteBatch.DrawString(Font, Text, New Vector2(Position.X + Height + 10, Position.Y + textY), Color.White) Core.SpriteBatch.DrawString(Font, Text, New Vector2(Position.X + Height + 10, Position.Y + textY), Color.White)
End Sub End Sub
' It will leak.
Private Function GetItemTypeTexture(ByVal itemType As Items.ItemTypes) As Texture2D Private Function GetItemTypeTexture(ByVal itemType As Items.ItemTypes) As Texture2D
Dim i As Integer = 0 Dim i As Integer = 0
Select Case itemType Select Case itemType
@ -1246,7 +1241,7 @@ Public Class TradeScreen
i = 7 i = 7
End Select End Select
Return TextureManager.TextureRectangle(TextureManager.GetTexture("GUI\Menus\BagPack"), New Rectangle(i * 24, 150, 24, 24)) Return TextureManager.GetTexture(TextureManager.GetTexture("GUI\Menus\BagPack"), New Rectangle(i * 24, 150, 24, 24))
End Function End Function
Private Function GetCurrencyAmount() As Integer Private Function GetCurrencyAmount() As Integer

View File

@ -12,7 +12,6 @@
Me.PreScreen = currentScreen Me.PreScreen = currentScreen
Me.mainTexture = TextureManager.GetTexture("GUI\Menus\Menu") Me.mainTexture = TextureManager.GetTexture("GUI\Menus\Menu")
CanvasTexture1 = TextureManager.TextureRectangle(mainTexture, New Rectangle(0, 0, 48, 48))
If Screen.Level.Surfing = True Then If Screen.Level.Surfing = True Then
Me.charTexture = TextureManager.GetTexture("Textures\NPC\" & Core.Player.TempSurfSkin) Me.charTexture = TextureManager.GetTexture("Textures\NPC\" & Core.Player.TempSurfSkin)
@ -26,7 +25,7 @@
Dim frameSize As Size = New Size(CInt(Me.charTexture.Width / 3), CInt(Me.charTexture.Height / 4)) Dim frameSize As Size = New Size(CInt(Me.charTexture.Width / 3), CInt(Me.charTexture.Height / 4))
Me.charTexture = TextureManager.TextureRectangle(Me.charTexture, New Rectangle(0, frameSize.Width * 2, frameSize.Width, frameSize.Height)) Me.charTexture = TextureManager.GetTexture(Me.charTexture, New Rectangle(0, frameSize.Width * 2, frameSize.Width, frameSize.Height))
Dim hasKanto As Boolean = True Dim hasKanto As Boolean = True
For i = 1 To 8 For i = 1 To 8
@ -49,12 +48,10 @@
End If End If
End Sub End Sub
Dim CanvasTexture1 As Texture2D
Public Overrides Sub Draw() Public Overrides Sub Draw()
Me.PreScreen.Draw() Me.PreScreen.Draw()
Canvas.DrawImageBorder(CanvasTexture1, 2, New Rectangle(60, 100, 800, 480)) Canvas.DrawImageBorder(TextureManager.GetTexture(mainTexture, New Rectangle(0, 0, 48, 48)), 2, New Rectangle(60, 100, 800, 480))
DrawHeader() DrawHeader()
DrawContent() DrawContent()
DrawBadges() DrawBadges()
@ -63,7 +60,7 @@
End Sub End Sub
Private Sub DrawHeader() Private Sub DrawHeader()
Canvas.DrawImageBorder(CanvasTexture1, 2, New Rectangle(60, 100, 480, 64)) Canvas.DrawImageBorder(TextureManager.GetTexture(mainTexture, New Rectangle(0, 0, 48, 48)), 2, New Rectangle(60, 100, 480, 64))
Core.SpriteBatch.Draw(mainTexture, New Rectangle(78, 124, 60, 48), New Rectangle(108, 112, 20, 16), Color.White) Core.SpriteBatch.Draw(mainTexture, New Rectangle(78, 124, 60, 48), New Rectangle(108, 112, 20, 16), Color.White)
Core.SpriteBatch.DrawString(FontManager.InGameFont, Localization.GetString("trainer_screen_trainer_card"), New Vector2(154, 132), Color.Black) Core.SpriteBatch.DrawString(FontManager.InGameFont, Localization.GetString("trainer_screen_trainer_card"), New Vector2(154, 132), Color.Black)
End Sub End Sub
@ -116,7 +113,7 @@
Core.SpriteBatch.DrawString(FontManager.MiniFont, "$" & .Money & vbNewLine & vbNewLine & Pokedex.CountEntries(Core.Player.PokedexData, {2, 3}) & " /" & Pokedex.CountEntries(Core.Player.PokedexData, {1, 2, 3}) & vbNewLine & vbNewLine & TimeHelpers.GetDisplayTime(TimeHelpers.GetCurrentPlayTime(), True), New Vector2(700, 220), Color.DarkBlue) Core.SpriteBatch.DrawString(FontManager.MiniFont, "$" & .Money & vbNewLine & vbNewLine & Pokedex.CountEntries(Core.Player.PokedexData, {2, 3}) & " /" & Pokedex.CountEntries(Core.Player.PokedexData, {1, 2, 3}) & vbNewLine & vbNewLine & TimeHelpers.GetDisplayTime(TimeHelpers.GetCurrentPlayTime(), True), New Vector2(700, 220), Color.DarkBlue)
End With End With
Else Else
Canvas.DrawImageBorder(CanvasTexture1, 2, New Rectangle(572, 100, 288, 288)) Canvas.DrawImageBorder(TextureManager.GetTexture(mainTexture, New Rectangle(0, 0, 48, 48)), 2, New Rectangle(572, 100, 288, 288))
Core.SpriteBatch.DrawString(FontManager.MiniFont, Localization.GetString("trainer_screen_name") & ": " & vbNewLine & vbNewLine & Localization.GetString("trainer_screen_points") & ": " & vbNewLine & vbNewLine & Localization.GetString("trainer_screen_money") & ": " & vbNewLine & vbNewLine & Localization.GetString("trainer_screen_pokedex") & ": " & vbNewLine & vbNewLine & Localization.GetString("trainer_screen_time") & ": ", New Vector2(108, 220), Color.Black) Core.SpriteBatch.DrawString(FontManager.MiniFont, Localization.GetString("trainer_screen_name") & ": " & vbNewLine & vbNewLine & Localization.GetString("trainer_screen_points") & ": " & vbNewLine & vbNewLine & Localization.GetString("trainer_screen_money") & ": " & vbNewLine & vbNewLine & Localization.GetString("trainer_screen_pokedex") & ": " & vbNewLine & vbNewLine & Localization.GetString("trainer_screen_time") & ": ", New Vector2(108, 220), Color.Black)
@ -131,7 +128,7 @@
Core.SpriteBatch.Draw(charTexture, New Rectangle(601, 126, 256, 256), Color.White) Core.SpriteBatch.Draw(charTexture, New Rectangle(601, 126, 256, 256), Color.White)
End If End If
Canvas.DrawImageBorder(CanvasTexture1, 2, New Rectangle(60, 420, 800, 160)) Canvas.DrawImageBorder(TextureManager.GetTexture(mainTexture, New Rectangle(0, 0, 48, 48)), 2, New Rectangle(60, 420, 800, 160))
End Sub End Sub
Private Sub DrawBadges() Private Sub DrawBadges()
@ -194,13 +191,4 @@
Core.SetScreen(Me.PreScreen) Core.SetScreen(Me.PreScreen)
End If End If
End Sub 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 End Class