@Screen.ShowImage can now scale depending on size

This commit is contained in:
JappaWakka 2022-11-15 14:56:54 +01:00
parent 3bea96a5ea
commit 8ea37604eb
4 changed files with 32 additions and 10 deletions

View File

@ -33,14 +33,32 @@
Public Sub Draw()
If Me.Showing = True Then
Dim p As Vector2 = Core.GetMiddlePosition(New Size(320, 320))
Dim FrameSize As Size = New Size(288, 288)
Dim ImageSize As Size = New Size(288, 288)
If Texture.Width > Texture.Height Then
FrameSize.Width = CInt(Math.Ceiling(Texture.Width / Texture.Height) * 288)
ImageSize.Width = CInt(Texture.Width / Texture.Height * 288)
While ImageSize.Width > FrameSize.Width - 32
FrameSize.Width += 32
End While
End If
If Texture.Height > Texture.Width Then
FrameSize.Height = CInt(Math.Floor(Texture.Height / Texture.Width) * 288)
ImageSize.Height = CInt(Texture.Height / Texture.Width * 288)
While ImageSize.Height > FrameSize.Height - 32
FrameSize.Height += 32
End While
End If
Canvas.DrawImageBorder(TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(0, 0, 48, 48), ""), 2, New Rectangle(CInt(p.X), CInt(p.Y), 320, 320))
Dim p As Vector2 = Core.GetMiddlePosition(New Size(FrameSize.Width + 64, FrameSize.Height + 64))
Dim pImage As Vector2 = Core.GetMiddlePosition(New Size(ImageSize.Width + 64, ImageSize.Height + 64))
Core.SpriteBatch.Draw(Me.Texture, New Rectangle(CInt(p.X) - 15, CInt(p.Y) - 90, 384, 384), Color.White)
Canvas.DrawImageBorder(TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(0, 0, 48, 48), ""), 2, New Rectangle(CInt(p.X - 32), CInt(p.Y - 32), FrameSize.Width + 64, FrameSize.Height + 64))
Core.SpriteBatch.Draw(Me.Texture, New Rectangle(CInt(pImage.X + 16), CInt(pImage.Y + 16), ImageSize.Width, ImageSize.Height), Color.White)
If Me.Delay = 0.0F Then
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Overworld\TextBox"), New Rectangle(CInt(p.X) + 144 + 160, CInt(p.Y) + 144 + 160 + 32, 16, 16), New Rectangle(0, 48, 16, 16), Color.White)
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Overworld\TextBox"), New Rectangle(CInt(p.X - 32) + FrameSize.Width + 64 - 16, CInt(p.Y - 32) + FrameSize.Height + 64 + 16, 16, 16), New Rectangle(0, 48, 16, 16), Color.White)
End If
End If
End Sub

View File

@ -494,13 +494,17 @@
Select Case Screen.Level.World.EnvironmentType
Case P3D.World.EnvironmentTypes.Outside
Me.Shader = New Vector3(1.0F)
Case P3D.World.EnvironmentTypes.Dark Or Screen.Level.LightingType = 6
Case P3D.World.EnvironmentTypes.Dark
Me.Shader = New Vector3(0.5F)
Case Else
Me.Shader = New Vector3(1.0F)
End Select
End If
If Screen.Level.LightingType = 6 Then
Me.Shader = New Vector3(0.5F)
End If
For Each s As Vector3 In Me.Shaders
Me.Shader *= s
Next

View File

@ -94,7 +94,7 @@
IsReady = True
Screen.Level.OverworldPokemon.Visible = False
Case "turn"
Dim TurnAmount As Integer = argument.GetSplit(0, ",")
Dim TurnAmount As Integer = int(argument.GetSplit(0, ","))
Dim ForceCameraTurn As Boolean = False
If argument.Split(",").Count > 1 Then
ForceCameraTurn = CBool(argument.GetSplit(1, ","))
@ -125,7 +125,7 @@
End If
End If
Case "turnasync"
Dim TurnAmount As Integer = argument.GetSplit(0, ",")
Dim TurnAmount As Integer = int(argument.GetSplit(0, ","))
Dim ForceCameraTurn As Boolean = False
If argument.Split(",").Count > 1 Then
ForceCameraTurn = CBool(argument.GetSplit(1, ","))

View File

@ -142,12 +142,12 @@
CanContinue = False
Case "showimage"
'@screen.showimage(str_texture,[str_sfxname],[int_x],[int_y],[int_w],[int_h]))
'@screen.showimage(str_texture,[str_sfxname],[int_x],[int_y],[int_w],[int_h])
Dim Texture As Texture2D = TextureManager.GetTexture(argument.GetSplit(0))
Dim Sound As String = ""
If argument.Split.Count > 1 Then
If argument.Split(",").Count > 1 Then
Sound = argument.GetSplit(1)
If argument.Split.Count > 2 Then
If argument.Split(",").Count > 2 Then
Texture = TextureManager.GetTexture(argument.GetSplit(0), New Rectangle(int(argument.GetSplit(2)), int(argument.GetSplit(3)), int(argument.GetSplit(4)), int(argument.GetSplit(5))), "")
End If
End If