Implemented InterfaceScale option
This commit is contained in:
parent
5c3adbcb2a
commit
721b7d992c
|
@ -283,7 +283,7 @@ Public Class CoreSpriteBatch
|
|||
''' <param name="Font">A font for diplaying text.</param>
|
||||
''' <param name="Text">A text string.</param>
|
||||
''' <param name="Position">The location (in screen coordinates) to draw the sprite.</param>
|
||||
''' <param name="Color">The color to tint a sprite. Use Color.White for full color with no tinting.</param>
|
||||
''' <param name="Color">The color to tint a sprite. Use Color.White for full color with no tinting.</param>interfacescal
|
||||
''' <param name="Rotation">Specifies the angle (in radians) to rotate the sprite about its center.</param>
|
||||
''' <param name="Origin">The sprite origin; the default is (0,0) which represents the upper-left corner.</param>
|
||||
''' <param name="Scale">Scale factor.</param>
|
||||
|
@ -307,10 +307,22 @@ Public Class CoreSpriteBatch
|
|||
''' </summary>
|
||||
Public ReadOnly Property InterfaceScale() As Double
|
||||
Get
|
||||
If Core.windowSize.Height < Core.CurrentScreen.GetScreenScaleMinimum().Height Or Core.windowSize.Width < Core.CurrentScreen.GetScreenScaleMinimum().Width Then
|
||||
Return 0.5D
|
||||
End If
|
||||
Return 1D
|
||||
Select Case Core.GameOptions.InterfaceScale
|
||||
Case 1
|
||||
Return 0.5D
|
||||
Case 2
|
||||
Return 1D
|
||||
Case 3
|
||||
Return 2d
|
||||
Case Else
|
||||
If Core.windowSize.Height < Core.CurrentScreen.GetScreenScaleMinimum().Height Or Core.windowSize.Width < Core.CurrentScreen.GetScreenScaleMinimum().Width Then
|
||||
Return 0.5D
|
||||
End If
|
||||
If Core.windowSize.Height > Core.CurrentScreen.GetScreenScaleMaximum().Height Or Core.windowSize.Width > Core.CurrentScreen.GetScreenScaleMaximum().Width Then
|
||||
Return 2D
|
||||
End If
|
||||
Return 1D
|
||||
End Select
|
||||
End Get
|
||||
End Property
|
||||
|
||||
|
|
|
@ -15,7 +15,16 @@
|
|||
Public MaxOffsetLevel As Integer = 0
|
||||
Public UpdateDisabled As Boolean = False
|
||||
Public Extras As New List(Of String)
|
||||
Private _interfaceScale As Integer = 0
|
||||
|
||||
Public Property InterfaceScale As Integer
|
||||
Get
|
||||
Return _interfaceScale
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
_interfaceScale = CInt(value)
|
||||
End Set
|
||||
End Property
|
||||
Public Sub LoadOptions()
|
||||
KeyBindings.CreateKeySave(False)
|
||||
If Directory.Exists(GameController.GamePath & "\Save\") = False Then
|
||||
|
@ -109,6 +118,8 @@
|
|||
End If
|
||||
Case "updatedisabled"
|
||||
UpdateDisabled = CBool(value)
|
||||
Case "interfacescale"
|
||||
InterfaceScale = CInt(value)
|
||||
End Select
|
||||
End If
|
||||
Next
|
||||
|
@ -153,6 +164,7 @@
|
|||
"ForceMusic|" & Me.ForceMusic.ToNumberString() & Environment.NewLine &
|
||||
"MaxOffsetLevel|" & Me.MaxOffsetLevel.ToString() & Environment.NewLine &
|
||||
"UpdateDisabled|" & Me.UpdateDisabled.ToNumberString() & Environment.NewLine &
|
||||
"InterfaceScale|" & Me.InterfaceScale.ToString() & Environment.NewLine &
|
||||
"Extras|" & String.Join(";", Me.Extras)
|
||||
|
||||
File.WriteAllText(GameController.GamePath & "\Save\options.dat", Data)
|
||||
|
@ -184,6 +196,7 @@
|
|||
"ForceMusic|0" & Environment.NewLine &
|
||||
"MaxOffsetLevel|0" & Environment.NewLine &
|
||||
"UpdateDisabled|0" & Environment.NewLine &
|
||||
"InterfaceScale|0" & Environment.NewLine &
|
||||
"Extras|"
|
||||
|
||||
File.WriteAllText(GameController.GamePath & "\Save\options.dat", s)
|
||||
|
|
|
@ -145,6 +145,7 @@
|
|||
Public Sub Draw(ByVal Position As Vector2, Optional ByVal DrawBox As Boolean = True, Optional ByVal Size As Single = 1.0F)
|
||||
If Me.Showing = True Then
|
||||
With Core.SpriteBatch
|
||||
Dim sizeMultiplier As Integer = CInt(3 * Math.Ceiling(Core.SpriteBatch.InterfaceScale))
|
||||
'Bounding box
|
||||
If DrawBox Then
|
||||
Dim MaxWidth = 0
|
||||
|
@ -156,7 +157,7 @@
|
|||
MaxWidth = 48
|
||||
End If
|
||||
Next
|
||||
Canvas.DrawImageBorder(TextureManager.GetTexture("GUI\Overworld\ChooseBox", New Rectangle(0, 0, 48, 48), ""), 3, New Rectangle(CInt(Position.X), CInt(Position.Y), CInt((MaxWidth * 3) * Size), CInt((48 * Size) * Options.Count)), True)
|
||||
Canvas.DrawImageBorder(TextureManager.GetTexture("GUI\Overworld\ChooseBox", New Rectangle(0, 0, 48, 48), ""), sizeMultiplier, New Rectangle(CInt(Position.X), CInt(Position.Y), CInt((MaxWidth * sizeMultiplier) * Size), CInt(48 * Size * Math.Ceiling(Core.SpriteBatch.InterfaceScale) * Options.Count)), False)
|
||||
End If
|
||||
'Text
|
||||
For i = 0 To Options.Count - 1
|
||||
|
@ -165,17 +166,18 @@
|
|||
Case "textfont", "braille"
|
||||
useSize = 2 * Size
|
||||
End Select
|
||||
.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)
|
||||
useSize = CInt(useSize * Math.Ceiling(Core.SpriteBatch.InterfaceScale))
|
||||
.DrawString(Me.TextFont.SpriteFont, Options(i).Replace("[POKE]", "Poké"), New Vector2(CInt(Position.X + CInt(48 * Math.Ceiling(Core.SpriteBatch.InterfaceScale))), CInt(Position.Y) + CInt((32 + i * 48 * Size) * Math.Ceiling(Core.SpriteBatch.InterfaceScale))), Color.Black, 0.0F, Vector2.Zero, useSize, SpriteEffects.None, 0.0F)
|
||||
Next
|
||||
'Cursor
|
||||
.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)
|
||||
.Draw(TextureManager.GetTexture("GUI\Overworld\ChooseBox"), New Rectangle(CInt(Position.X + CInt(24 * Math.Ceiling(Core.SpriteBatch.InterfaceScale))), CInt(Position.Y) + CInt((34 + CInt(index * 48 * Size)) * Math.Ceiling(Core.SpriteBatch.InterfaceScale)), CInt(24 * Size * Math.Ceiling(Core.SpriteBatch.InterfaceScale)), CInt(24 * Size * Math.Ceiling(Core.SpriteBatch.InterfaceScale))), New Rectangle(72, 0, 8, 8), Color.White)
|
||||
End With
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Sub Draw()
|
||||
If Me.Showing = True Then
|
||||
Dim Position As Vector2 = New Vector2(CInt(Core.windowSize.Width / 2) - 48, Core.windowSize.Height - 160.0F - 96.0F - (Options.Count - 1) * 48)
|
||||
Dim Position As Vector2 = New Vector2(CInt(Core.windowSize.Width / 2) - CInt(48 * Math.Ceiling(Core.SpriteBatch.InterfaceScale)), Core.windowSize.Height - CInt(160.0F * Math.Ceiling(Core.SpriteBatch.InterfaceScale)) - CInt(96.0F * Math.Ceiling(Core.SpriteBatch.InterfaceScale)) - CInt((Options.Count - 1) * 48 * Math.Ceiling(Core.SpriteBatch.InterfaceScale)))
|
||||
Me.Draw(Position)
|
||||
End If
|
||||
End Sub
|
||||
|
|
|
@ -116,7 +116,7 @@
|
|||
Public Sub Update()
|
||||
If Showing = True Then
|
||||
ResetCursor()
|
||||
If PositionY <= Core.windowSize.Height - 160.0F Then
|
||||
If PositionY <= Core.windowSize.Height - CSng(160.0F * Math.Ceiling(Core.SpriteBatch.InterfaceScale)) Then
|
||||
If through = False Then
|
||||
If Text.Count > currentChar Then
|
||||
If Delay <= 0.0F Then
|
||||
|
@ -216,7 +216,7 @@
|
|||
Public Sub Draw()
|
||||
If Me.Showing = True Then
|
||||
With Core.SpriteBatch
|
||||
.Draw(TextureManager.GetTexture("GUI\Overworld\TextBox"), New Rectangle(CInt(Core.windowSize.Width / 2) - 240, CInt(PositionY), 480, 144), New Rectangle(0, 0, 160, 48), Color.White)
|
||||
.Draw(TextureManager.GetTexture("GUI\Overworld\TextBox"), New Rectangle(CInt(Core.windowSize.Width / 2) - CInt(240 * Math.Ceiling(Core.SpriteBatch.InterfaceScale)), CInt(PositionY), CInt(480 * Math.Ceiling(Core.SpriteBatch.InterfaceScale)), CInt(144 * Math.Ceiling(Core.SpriteBatch.InterfaceScale))), New Rectangle(0, 0, 160, 48), Color.White)
|
||||
|
||||
Dim m As Single = 1.0F
|
||||
Select Case Me.TextFont.FontName.ToLower()
|
||||
|
@ -224,11 +224,12 @@
|
|||
m = 2.0F
|
||||
End Select
|
||||
|
||||
.DrawString(Me.TextFont.SpriteFont, Me.showText(0), New Vector2(CInt(Core.windowSize.Width / 2) - 210, CInt(PositionY) + 40), Me.TextColor, 0.0F, Vector2.Zero, m, SpriteEffects.None, 0.0F)
|
||||
.DrawString(Me.TextFont.SpriteFont, Me.showText(1), New Vector2(CInt(Core.windowSize.Width / 2) - 210, CInt(PositionY) + 75), Me.TextColor, 0.0F, Vector2.Zero, m, SpriteEffects.None, 0.0F)
|
||||
m = CInt(m * Math.Ceiling(Core.SpriteBatch.InterfaceScale))
|
||||
.DrawString(Me.TextFont.SpriteFont, Me.showText(0), New Vector2(CInt(Core.windowSize.Width / 2) - CInt(210 * Math.Ceiling(Core.SpriteBatch.InterfaceScale)), CInt(PositionY) + CInt(40 * Math.Ceiling(Core.SpriteBatch.InterfaceScale))), Me.TextColor, 0.0F, Vector2.Zero, m, SpriteEffects.None, 0.0F)
|
||||
.DrawString(Me.TextFont.SpriteFont, Me.showText(1), New Vector2(CInt(Core.windowSize.Width / 2) - CInt(210 * Math.Ceiling(Core.SpriteBatch.InterfaceScale)), CInt(PositionY) + CInt(75 * Math.Ceiling(Core.SpriteBatch.InterfaceScale))), Me.TextColor, 0.0F, Vector2.Zero, m, SpriteEffects.None, 0.0F)
|
||||
|
||||
If Me.CanProceed = True And Me.through = True Then
|
||||
.Draw(TextureManager.GetTexture("GUI\Overworld\TextBox"), New Rectangle(CInt(Core.windowSize.Width / 2) + 192, CInt(PositionY) + 128, 16, 16), New Rectangle(0, 48, 16, 16), Color.White)
|
||||
.Draw(TextureManager.GetTexture("GUI\Overworld\TextBox"), New Rectangle(CInt(Core.windowSize.Width / 2) + CInt(192 * Math.Ceiling(Core.SpriteBatch.InterfaceScale)), CInt(PositionY) + CInt(128 * Math.Ceiling(Core.SpriteBatch.InterfaceScale)), CInt(16 * Math.Ceiling(Core.SpriteBatch.InterfaceScale)), CInt(16 * Math.Ceiling(Core.SpriteBatch.InterfaceScale))), New Rectangle(0, 48, 16, 16), Color.White)
|
||||
End If
|
||||
End With
|
||||
End If
|
||||
|
|
|
@ -13,6 +13,7 @@ Public Class NewOptionScreen
|
|||
Dim ShowBattleAnimations As Integer = 1
|
||||
Dim DiagonalMovement As Boolean = True
|
||||
Dim Difficulty As Integer = 0
|
||||
Dim InterfaceScale As Integer = 0
|
||||
Dim BattleStyle As Integer = 1
|
||||
Dim LoadOffsetMaps As Integer = 1
|
||||
Dim ViewBobbing As Boolean = True
|
||||
|
@ -130,6 +131,7 @@ Public Class NewOptionScreen
|
|||
Me.Sound = CInt(SoundManager.Volume * 100)
|
||||
Me.RenderDistance = Core.GameOptions.RenderDistance
|
||||
Me.GraphicStyle = Core.GameOptions.GraphicStyle
|
||||
Me.InterfaceScale = Core.GameOptions.InterfaceScale
|
||||
Me.ShowBattleAnimations = Core.Player.ShowBattleAnimations
|
||||
Me.DiagonalMovement = Core.Player.DiagonalMovement
|
||||
Me.BattleStyle = Core.Player.BattleStyle
|
||||
|
@ -749,7 +751,6 @@ Public Class NewOptionScreen
|
|||
End If
|
||||
Next
|
||||
If ScrollControl IsNot Nothing Then
|
||||
cPosition.X += 332
|
||||
End If
|
||||
|
||||
_cursorDestPosition = cPosition
|
||||
|
@ -942,8 +943,16 @@ Public Class NewOptionScreen
|
|||
|
||||
Me.ControlList.Add(New ScrollBar(New Vector2(Delta_X + 100, Delta_Y + 120), 400, Localization.GetString("option_screen_game_difficulty", "Difficulty"), Me.Difficulty, 0, 2, AddressOf ChangeDifficulty, d, 2))
|
||||
End If
|
||||
Me.ControlList.Add(New ToggleButton(New Vector2(Delta_X + 100, Delta_Y + 180), 3, 64, Localization.GetString("option_screen_game_viewbobbing", "View Bobbing"), Me.ViewBobbing, AddressOf ToggleBobbing, {Localization.GetString("global_off", "Off"), Localization.GetString("global_on", "On")}.ToList(), 3))
|
||||
Me.ControlList.Add(New CommandButton(New Vector2(Delta_X + 530 + 24, Delta_Y + 327), 1, 48, Localization.GetString("global_back", "Back"), AddressOf SwitchToMain, 4))
|
||||
Dim s As New Dictionary(Of Integer, String)
|
||||
s.Add(0, Localization.GetString("option_screen_game_interfacescale_automatic", "Automatic"))
|
||||
s.Add(1, "0.5x")
|
||||
s.Add(2, "1x")
|
||||
s.Add(3, "2x")
|
||||
|
||||
Me.ControlList.Add(New ScrollBar(New Vector2(Delta_X + 100, Delta_Y + 180), 400, Localization.GetString("option_screen_game_interfacescale", "Interface Scale"), Me.InterfaceScale, 0, 3, AddressOf ChangeInterfaceScale, s, 3))
|
||||
|
||||
Me.ControlList.Add(New ToggleButton(New Vector2(Delta_X + 100, Delta_Y + 240), 3, 64, Localization.GetString("option_screen_game_viewbobbing", "View Bobbing"), Me.ViewBobbing, AddressOf ToggleBobbing, {Localization.GetString("global_off", "Off"), Localization.GetString("global_on", "On")}.ToList(), 4))
|
||||
Me.ControlList.Add(New CommandButton(New Vector2(Delta_X + 530 + 24, Delta_Y + 327), 1, 48, Localization.GetString("global_back", "Back"), AddressOf SwitchToMain, 5))
|
||||
|
||||
Case 2 ' "Graphics" from the Options menu.
|
||||
Me.ControlList.Add(New ScrollBar(New Vector2(Delta_X + 100, Delta_Y + 40), 400, Localization.GetString("option_screen_graphics_fov", "Field of View"), CInt(Me.FOV), 45, 120, AddressOf ChangeFOV, 1))
|
||||
|
@ -1074,6 +1083,7 @@ Public Class NewOptionScreen
|
|||
Me.Sound = 50
|
||||
Me.RenderDistance = 2
|
||||
Me.GraphicStyle = 1
|
||||
Me.InterfaceScale = 0
|
||||
Me.ShowBattleAnimations = 1
|
||||
Me.DiagonalMovement = False
|
||||
Me.Difficulty = 0
|
||||
|
@ -1095,6 +1105,7 @@ Public Class NewOptionScreen
|
|||
SoundManager.Muted = CBool(Me.Muted)
|
||||
Core.GameOptions.RenderDistance = Me.RenderDistance
|
||||
Core.GameOptions.GraphicStyle = Me.GraphicStyle
|
||||
Core.GameOptions.InterfaceScale = Me.InterfaceScale
|
||||
If PreScreen.Identification <> Identifications.MainMenuScreen Then
|
||||
Camera.CreateNewProjection(Me.FOV)
|
||||
TextBox.TextSpeed = Me.TextSpeed
|
||||
|
@ -1251,6 +1262,9 @@ Public Class NewOptionScreen
|
|||
Private Sub ChangeDifficulty(ByVal c As ScrollBar)
|
||||
Me.Difficulty = c.Value
|
||||
End Sub
|
||||
Private Sub ChangeInterfaceScale(ByVal c As ScrollBar)
|
||||
Me.InterfaceScale = c.Value
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
|
|
|
@ -446,6 +446,16 @@ Public MustInherit Class Screen
|
|||
Return New Size(800, 620)
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Returns the maximum size for the screen size to display a regular interface before switching to the large size.
|
||||
''' </summary>
|
||||
''' <returns></returns>
|
||||
''' <remarks>The default size is 800x620 pixels.</remarks>
|
||||
Public Overridable Function GetScreenScaleMaximum() As Size
|
||||
'// Default size: 2560x1440 pixels.
|
||||
Return New Size(2560, 1440)
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Returns the spritebatch that should render a font.
|
||||
''' </summary>
|
||||
|
|
Loading…
Reference in New Issue