Better implementation of the ChooseBox texture

This commit is contained in:
JappaWakka 2022-04-16 14:35:35 +02:00
parent 9058caa13a
commit 249a93bc3f
3 changed files with 12 additions and 16 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 738 B

After

Width:  |  Height:  |  Size: 312 B

View File

@ -147,11 +147,7 @@
With Core.SpriteBatch With Core.SpriteBatch
'Bounding box 'Bounding box
If DrawBox Then If DrawBox Then
.Draw(TextureManager.GetTexture("GUI\Overworld\ChooseBox"), New Rectangle(CInt(Position.X), CInt(Position.Y), 288, 48), New Rectangle(0, 0, 96, 16), Color.White) Canvas.DrawImageBorder(TextureManager.GetTexture("GUI\Overworld\ChooseBox", New Rectangle(0, 0, 72, 48), ""), 3, New Rectangle(CInt(Position.X), CInt(Position.Y), 360, CInt(48 * Options.Count)), True)
For i = 0 To Options.Count - 2
.Draw(TextureManager.GetTexture("GUI\Overworld\ChooseBox"), New Rectangle(CInt(Position.X), CInt(Position.Y) + 48 + i * 48, 288, 48), New Rectangle(0, 16, 96, 16), Color.White)
Next
.Draw(TextureManager.GetTexture("GUI\Overworld\ChooseBox"), New Rectangle(CInt(Position.X), CInt(Position.Y) + 96 + (Options.Count - 2) * 48, 288, 48), New Rectangle(0, 32, 96, 16), Color.White)
End If End If
'Text 'Text
For i = 0 To Options.Count - 1 For i = 0 To Options.Count - 1
@ -160,10 +156,10 @@
Case "textfont", "braille" Case "textfont", "braille"
useSize = 2 * Size useSize = 2 * Size
End Select End Select
.DrawString(Me.TextFont.SpriteFont, Options(i).Replace("[POKE]", "Poké"), New Vector2(CInt(Position.X + 40), CInt(Position.Y) + 32 + i * 48 * Size), Color.Black, 0.0F, Vector2.Zero, useSize, SpriteEffects.None, 0.0F) .DrawString(Me.TextFont.SpriteFont, Options(i).Replace("[POKE]", "Poké"), New Vector2(CInt(Position.X + 48), CInt(Position.Y) + 32 + i * 48 * Size), Color.Black, 0.0F, Vector2.Zero, useSize, SpriteEffects.None, 0.0F)
Next Next
'Cursor 'Cursor
.Draw(TextureManager.GetTexture("GUI\Overworld\ChooseBox"), New Rectangle(CInt(Position.X + 20), CInt(Position.Y) + 36 + CInt(index * 48 * Size), CInt(10 * Size), CInt(20 * Size)), New Rectangle(96, 0, 3, 6), Color.White) .Draw(TextureManager.GetTexture("GUI\Overworld\ChooseBox"), New Rectangle(CInt(Position.X + 24), CInt(Position.Y) + 34 + CInt(index * 48 * Size), CInt(24 * Size), CInt(24 * Size)), New Rectangle(72, 0, 8, 8), Color.White)
End With End With
End If End If
End Sub End Sub

View File

@ -36,11 +36,11 @@
DrawRectangle(New Rectangle(Rectangle.X, Rectangle.Y, borderLength, Rectangle.Height - borderLength), color, ScaleToScreen) DrawRectangle(New Rectangle(Rectangle.X, Rectangle.Y, borderLength, Rectangle.Height - borderLength), color, ScaleToScreen)
End Sub End Sub
Public Shared Sub DrawImageBorder(ByVal Texture As Texture2D, ByVal SizeMulitiplier As Integer, ByVal Rectangle As Rectangle, ByVal Color As Color, ByVal ScaleToScreen As Boolean) Public Shared Sub DrawImageBorder(ByVal Texture As Texture2D, ByVal SizeMultiplier As Integer, ByVal Rectangle As Rectangle, ByVal Color As Color, ByVal ScaleToScreen As Boolean)
Dim borderSize As New Vector2(Rectangle.Width, Rectangle.Height) Dim borderSize As New Vector2(Rectangle.Width, Rectangle.Height)
For x = 0 To borderSize.X Step CInt(Math.Floor(Texture.Width / 3)) * SizeMulitiplier For x = 0 To borderSize.X Step CInt(Math.Floor(Texture.Width / 3)) * SizeMultiplier
For y = 0 To borderSize.Y Step CInt(Math.Floor(Texture.Height / 3)) * SizeMulitiplier For y = 0 To borderSize.Y Step CInt(Math.Floor(Texture.Height / 3)) * SizeMultiplier
Dim width As Integer = CInt(Math.Floor(Texture.Width / 3)) Dim width As Integer = CInt(Math.Floor(Texture.Width / 3))
Dim height As Integer = CInt(Math.Floor(Texture.Height / 3)) Dim height As Integer = CInt(Math.Floor(Texture.Height / 3))
@ -65,20 +65,20 @@
End If End If
If ScaleToScreen = True Then If ScaleToScreen = True Then
Core.SpriteBatch.DrawInterface(Texture, New Rectangle(CInt(Math.Floor(x)) + Rectangle.X, CInt(Math.Floor(y)) + Rectangle.Y, SizeMulitiplier * width, SizeMulitiplier * height), Tile, Color.White) Core.SpriteBatch.DrawInterface(Texture, New Rectangle(CInt(Math.Floor(x)) + Rectangle.X, CInt(Math.Floor(y)) + Rectangle.Y, SizeMultiplier * width, SizeMultiplier * height), Tile, Color.White)
Else Else
Core.SpriteBatch.Draw(Texture, New Rectangle(CInt(Math.Floor(x)) + Rectangle.X, CInt(Math.Floor(y)) + Rectangle.Y, SizeMulitiplier * width, SizeMulitiplier * height), Tile, Color.White) Core.SpriteBatch.Draw(Texture, New Rectangle(CInt(Math.Floor(x)) + Rectangle.X, CInt(Math.Floor(y)) + Rectangle.Y, SizeMultiplier * width, SizeMultiplier * height), Tile, Color.White)
End If End If
Next Next
Next Next
End Sub End Sub
Public Shared Sub DrawImageBorder(ByVal Texture As Texture2D, ByVal SizeMulitiplier As Integer, ByVal Rectangle As Rectangle) Public Shared Sub DrawImageBorder(ByVal Texture As Texture2D, ByVal SizeMultiplier As Integer, ByVal Rectangle As Rectangle)
DrawImageBorder(Texture, SizeMulitiplier, Rectangle, Color.White, False) DrawImageBorder(Texture, SizeMultiplier, Rectangle, Color.White, False)
End Sub End Sub
Public Shared Sub DrawImageBorder(ByVal Texture As Texture2D, ByVal SizeMulitiplier As Integer, ByVal Rectangle As Rectangle, ByVal ScaleToScreen As Boolean) Public Shared Sub DrawImageBorder(ByVal Texture As Texture2D, ByVal SizeMultiplier As Integer, ByVal Rectangle As Rectangle, ByVal ScaleToScreen As Boolean)
DrawImageBorder(Texture, SizeMulitiplier, Rectangle, Color.White, ScaleToScreen) DrawImageBorder(Texture, SizeMultiplier, Rectangle, Color.White, ScaleToScreen)
End Sub End Sub
#End Region #End Region