mirror of
https://github.com/P3D-Legacy/P3D-Legacy.git
synced 2025-07-28 16:24:45 +02:00
Fix for incorrect Main Menu scaling at lower resolutions
Also made the contents of the pausescreen at least stay inside the window at lower resolutions
This commit is contained in:
parent
88fc909529
commit
6ee71755af
@ -50,11 +50,11 @@
|
|||||||
Public Overrides Sub Draw()
|
Public Overrides Sub Draw()
|
||||||
Me.PreScreen.Draw()
|
Me.PreScreen.Draw()
|
||||||
|
|
||||||
Canvas.DrawRectangle(New Rectangle(0, 0, Core.ScreenSize.Width, Core.ScreenSize.Height), New Color(0, 0, 0, 150))
|
Canvas.DrawRectangle(New Rectangle(0, 0, Core.windowSize.Width, Core.windowSize.Height), New Color(0, 0, 0, 150))
|
||||||
Dim titletext As String = Localization.GetString("pause_menu_title")
|
Dim titletext As String = Localization.GetString("pause_menu_title")
|
||||||
Dim pX As Integer = CInt(Core.ScreenSize.Width / 2) - CInt(FontManager.InGameFont.MeasureString(titletext).X / 2)
|
Dim pX As Integer = CInt(Core.windowSize.Width / 2) - CInt(FontManager.InGameFont.MeasureString(titletext).X / 2)
|
||||||
Core.SpriteBatch.DrawInterfaceString(FontManager.InGameFont, titletext, New Vector2(pX - 7, CInt(160 - FontManager.InGameFont.MeasureString(titletext).Y / 2 + 3)), Color.Black)
|
Core.SpriteBatch.DrawInterfaceString(FontManager.InGameFont, titletext, New Vector2(CInt(pX - 7), CInt(160 - FontManager.InGameFont.MeasureString(titletext).Y / 2 + 3)), Color.Black)
|
||||||
Core.SpriteBatch.DrawInterfaceString(FontManager.InGameFont, titletext, New Vector2(pX - 10, CInt(160 - FontManager.InGameFont.MeasureString(titletext).Y / 2)), Color.White)
|
Core.SpriteBatch.DrawInterfaceString(FontManager.InGameFont, titletext, New Vector2(CInt(pX - 10), CInt(160 - FontManager.InGameFont.MeasureString(titletext).Y / 2)), Color.White)
|
||||||
|
|
||||||
If Me.menuIndex = 0 Then
|
If Me.menuIndex = 0 Then
|
||||||
DrawMenu()
|
DrawMenu()
|
||||||
@ -65,8 +65,8 @@
|
|||||||
If Me.canCreateAutosave = False Then
|
If Me.canCreateAutosave = False Then
|
||||||
Dim autosaveFailText As String = Localization.GetString("pause_menu_autosave_fail")
|
Dim autosaveFailText As String = Localization.GetString("pause_menu_autosave_fail")
|
||||||
|
|
||||||
Core.SpriteBatch.DrawInterfaceString(FontManager.InGameFont, autosaveFailText, New Vector2(9, Core.ScreenSize.Height - FontManager.InGameFont.MeasureString(autosaveFailText).Y), Color.Black)
|
Core.SpriteBatch.DrawInterfaceString(FontManager.InGameFont, autosaveFailText, New Vector2(9, CInt(Core.windowSize.Height - FontManager.InGameFont.MeasureString(autosaveFailText).Y)), Color.Black)
|
||||||
Core.SpriteBatch.DrawInterfaceString(FontManager.InGameFont, autosaveFailText, New Vector2(5, Core.ScreenSize.Height - FontManager.InGameFont.MeasureString(autosaveFailText).Y - 4), Color.White)
|
Core.SpriteBatch.DrawInterfaceString(FontManager.InGameFont, autosaveFailText, New Vector2(5, CInt(Core.windowSize.Height - FontManager.InGameFont.MeasureString(autosaveFailText).Y - 4)), Color.White)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Dim d As New Dictionary(Of Buttons, String)
|
Dim d As New Dictionary(Of Buttons, String)
|
||||||
@ -105,12 +105,12 @@
|
|||||||
End Select
|
End Select
|
||||||
|
|
||||||
If i = mainIndex Then
|
If i = mainIndex Then
|
||||||
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)
|
Canvas.DrawImageBorder(TextureManager.GetTexture(mainTexture, New Rectangle(0, 48, 48, 48)), 2, New Rectangle(CInt(Core.windowSize.Width / 2) - 180, 220 + i * 128, 320, 64), True)
|
||||||
Else
|
Else
|
||||||
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)
|
Canvas.DrawImageBorder(TextureManager.GetTexture(mainTexture, New Rectangle(0, 0, 48, 48)), 2, New Rectangle(CInt(Core.windowSize.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.windowSize.Width / 2 - FontManager.InGameFont.MeasureString(Text).X / 2 - 10), 256 + i * 128), Color.Black)
|
||||||
Next
|
Next
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
@ -124,7 +124,7 @@
|
|||||||
|
|
||||||
If Core.GameInstance.IsMouseVisible = True Then
|
If Core.GameInstance.IsMouseVisible = True Then
|
||||||
For i = 0 To 1
|
For i = 0 To 1
|
||||||
If Core.ScaleScreenRec(New Rectangle(CInt(Core.ScreenSize.Width / 2) - 180, 220 + i * 128, 320 + 32, 64 + 32)).Contains(MouseHandler.MousePosition) = True Then
|
If Core.ScaleScreenRec(New Rectangle(CInt(Core.windowSize.Width / 2) - 180, 220 + i * 128, 320 + 32, 64 + 32)).Contains(MouseHandler.MousePosition) = True Then
|
||||||
Me.mainIndex = i
|
Me.mainIndex = i
|
||||||
|
|
||||||
If Controls.Accept(True, False) = True Then
|
If Controls.Accept(True, False) = True Then
|
||||||
@ -182,9 +182,9 @@
|
|||||||
#Region "QuitMenu"
|
#Region "QuitMenu"
|
||||||
|
|
||||||
Private Sub DrawQuit()
|
Private Sub DrawQuit()
|
||||||
Dim pX As Integer = CInt(Core.ScreenSize.Width / 2) - CInt(FontManager.InGameFont.MeasureString(Localization.GetString("pause_menu_confirmation")).X / 2)
|
Dim pX As Integer = CInt(Core.windowSize.Width / 2) - CInt(FontManager.InGameFont.MeasureString(Localization.GetString("pause_menu_confirmation")).X / 2)
|
||||||
Core.SpriteBatch.DrawInterfaceString(FontManager.InGameFont, Localization.GetString("pause_menu_confirmation"), New Vector2(pX - 7, CInt(Core.ScreenSize.Height / 7.5) + 3 + 110), Color.Black)
|
Core.SpriteBatch.DrawInterfaceString(FontManager.InGameFont, Localization.GetString("pause_menu_confirmation"), New Vector2(pX - 7, CInt(Core.windowSize.Height / 7.5) + 3 + 110), Color.Black)
|
||||||
Core.SpriteBatch.DrawInterfaceString(FontManager.InGameFont, Localization.GetString("pause_menu_confirmation"), New Vector2(pX - 10, CInt(Core.ScreenSize.Height / 7.5) + 110), Color.White)
|
Core.SpriteBatch.DrawInterfaceString(FontManager.InGameFont, Localization.GetString("pause_menu_confirmation"), New Vector2(pX - 10, CInt(Core.windowSize.Height / 7.5) + 110), Color.White)
|
||||||
|
|
||||||
For i = 0 To 1
|
For i = 0 To 1
|
||||||
Dim Text As String = ""
|
Dim Text As String = ""
|
||||||
@ -199,12 +199,12 @@
|
|||||||
End Select
|
End Select
|
||||||
|
|
||||||
If i = quitIndex Then
|
If i = quitIndex Then
|
||||||
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)
|
Canvas.DrawImageBorder(TextureManager.GetTexture(mainTexture, New Rectangle(0, 48, 48, 48)), 2, New Rectangle(CInt(Core.windowSize.Width / 2) - 180 + x, 320, 320, 64), True)
|
||||||
Else
|
Else
|
||||||
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)
|
Canvas.DrawImageBorder(TextureManager.GetTexture(mainTexture, New Rectangle(0, 0, 48, 48)), 2, New Rectangle(CInt(Core.windowSize.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.windowSize.Width / 2 - (FontManager.InGameFont.MeasureString(Text).X / 2) - 10 + x), 356), Color.Black)
|
||||||
Next
|
Next
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
@ -223,7 +223,7 @@
|
|||||||
x = 200
|
x = 200
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If Core.ScaleScreenRec(New Rectangle(CInt(Core.ScreenSize.Width / 2) - 180 + x, 320, 320 + 32, 64 + 32)).Contains(MouseHandler.MousePosition) = True Then
|
If Core.ScaleScreenRec(New Rectangle(CInt(Core.windowSize.Width / 2) - 180 + x, 320, 320 + 32, 64 + 32)).Contains(MouseHandler.MousePosition) = True Then
|
||||||
Me.quitIndex = i
|
Me.quitIndex = i
|
||||||
|
|
||||||
If Controls.Accept(True, False) = True Then
|
If Controls.Accept(True, False) = True Then
|
||||||
|
@ -110,7 +110,6 @@ Public Class PressStartScreen
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Overrides Sub Update()
|
Public Overrides Sub Update()
|
||||||
|
|
||||||
For i = 0 To _entities.Count - 1
|
For i = 0 To _entities.Count - 1
|
||||||
If i < _entities.Count Then
|
If i < _entities.Count Then
|
||||||
_entities(i).Update()
|
_entities(i).Update()
|
||||||
@ -191,7 +190,7 @@ Public Class PressStartScreen
|
|||||||
|
|
||||||
_backgroundRenderer.Begin()
|
_backgroundRenderer.Begin()
|
||||||
Dim blurred = _blurHandler.Perform(target)
|
Dim blurred = _blurHandler.Perform(target)
|
||||||
_backgroundRenderer.Draw(blurred, New Rectangle(0, 0, ScreenSize.Width, ScreenSize.Height), Color.White)
|
_backgroundRenderer.Draw(blurred, New Rectangle(0, 0, windowSize.Width, windowSize.Height), Color.White)
|
||||||
|
|
||||||
'_backgroundRenderer.Draw(target, New Rectangle(0, 0, ScreenSize.Width, ScreenSize.Height), Color.White)
|
'_backgroundRenderer.Draw(target, New Rectangle(0, 0, ScreenSize.Width, ScreenSize.Height), Color.White)
|
||||||
_backgroundRenderer.End()
|
_backgroundRenderer.End()
|
||||||
@ -203,8 +202,10 @@ Public Class PressStartScreen
|
|||||||
End If
|
End If
|
||||||
_shineRenderer.Begin(SpriteSortMode.Texture, BlendState.Additive)
|
_shineRenderer.Begin(SpriteSortMode.Texture, BlendState.Additive)
|
||||||
|
|
||||||
_logoRenderer.Draw(_logoTexture, New Rectangle(CInt(ScreenSize.Width / 2) - 350, CInt(160 * _fadeInMain), 700, 300), New Color(255, 255, 255, CInt(255 * _logoFade)))
|
_logoRenderer.Draw(_logoTexture, New Rectangle(CInt(windowSize.Width / 2 - 350 * SpriteBatch.InterfaceScale), CInt(160 * _fadeInMain + 64),
|
||||||
_shineRenderer.Draw(_shineTexture, New Rectangle(CInt(ScreenSize.Width / 2 - 250 + Math.Sin(tempF) * 240.0F), CInt(-100 + Math.Sin(tempG) * 10.0F + CInt(160 * _fadeInMain)), 512, 512), New Color(255, 255, 255, CInt(255 * _logoFade)))
|
CInt(700 * SpriteBatch.InterfaceScale), CInt(300 * SpriteBatch.InterfaceScale)), New Color(255, 255, 255, CInt(255 * _logoFade)))
|
||||||
|
_shineRenderer.Draw(_shineTexture, New Rectangle(CInt(windowSize.Width / 2 - 250 * SpriteBatch.InterfaceScale + Math.Sin(tempF) * 240.0F), CInt(-100 + Math.Sin(tempG) * 10.0F + CInt(160 * _fadeInMain + 64)),
|
||||||
|
CInt(512 * SpriteBatch.InterfaceScale), CInt(512 * SpriteBatch.InterfaceScale)), New Color(255, 255, 255, CInt(255 * _logoFade)))
|
||||||
|
|
||||||
If _fadeInMain = 0F Then
|
If _fadeInMain = 0F Then
|
||||||
If IsCurrentScreen() And Core.GameOptions.ShowGUI Then ' Want to implement fading of text, but core doesn't seem to support this.
|
If IsCurrentScreen() And Core.GameOptions.ShowGUI Then ' Want to implement fading of text, but core doesn't seem to support this.
|
||||||
@ -218,11 +219,11 @@ Public Class PressStartScreen
|
|||||||
|
|
||||||
Dim textSize As Vector2 = FontManager.InGameFont.MeasureString(text)
|
Dim textSize As Vector2 = FontManager.InGameFont.MeasureString(text)
|
||||||
|
|
||||||
GetFontRenderer().DrawString(FontManager.InGameFont, text, New Vector2(ScreenSize.Width / 2.0F - textSize.X / 2.0F,
|
GetFontRenderer().DrawString(FontManager.InGameFont, text, New Vector2(CInt(windowSize.Width / 2.0F - textSize.X / 2.0F),
|
||||||
ScreenSize.Height - textSize.Y - 50), _textColor)
|
CInt(windowSize.Height - textSize.Y - 50)), _textColor)
|
||||||
|
|
||||||
If ControllerHandler.IsConnected() Then
|
If ControllerHandler.IsConnected() Then
|
||||||
SpriteBatch.Draw(TextureManager.GetTexture("GUI\GamePad\xboxControllerButtonA"), New Rectangle(CInt(ScreenSize.Width / 2 - textSize.X / 2 + FontManager.InGameFont.MeasureString("Press" & " ").X + 2), CInt(ScreenSize.Height - textSize.Y - 58), 40, 40), Color.White)
|
SpriteBatch.Draw(TextureManager.GetTexture("GUI\GamePad\xboxControllerButtonA"), New Rectangle(CInt(windowSize.Width / 2 - textSize.X / 2 + FontManager.InGameFont.MeasureString("Press" & " ").X + 2), CInt(ScreenSize.Height - textSize.Y - 58), 40, 40), Color.White)
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
@ -230,7 +231,7 @@ Public Class PressStartScreen
|
|||||||
_logoRenderer.End()
|
_logoRenderer.End()
|
||||||
_shineRenderer.End()
|
_shineRenderer.End()
|
||||||
|
|
||||||
Canvas.DrawRectangle(ScreenSize, New Color(0, 0, 0, CInt(255 * _fadeInMain)))
|
Canvas.DrawRectangle(windowSize, New Color(0, 0, 0, CInt(255 * _fadeInMain)))
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Overrides Sub ChangeTo()
|
Public Overrides Sub ChangeTo()
|
||||||
@ -628,7 +629,7 @@ Public Class NewMainMenuScreen
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub UpdateScreenOffset()
|
Private Sub UpdateScreenOffset()
|
||||||
_screenOrigin = New Vector2(CSng(ScreenSize.Width / 2 - 80 - 180), CSng(ScreenSize.Height / 2 - 80))
|
_screenOrigin = New Vector2(CSng((windowSize.Width / 2 - 80 - 180) * SpriteBatch.InterfaceScale), CSng((windowSize.Height / 2 - 80)))
|
||||||
If _screenOffset.X > _screenOffsetTarget.X Then
|
If _screenOffset.X > _screenOffsetTarget.X Then
|
||||||
_screenOffset.X = MathHelper.Lerp(_screenOffsetTarget.X, _screenOffset.X, 0.93F)
|
_screenOffset.X = MathHelper.Lerp(_screenOffsetTarget.X, _screenOffset.X, 0.93F)
|
||||||
If _screenOffset.X - 0.01F <= _screenOffsetTarget.X Then
|
If _screenOffset.X - 0.01F <= _screenOffsetTarget.X Then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user