Made some GUI stuff scale with interfacescale
* Trainer Card * Save Screen * MessageBox (like when your files are invalid)
This commit is contained in:
parent
8b7363364c
commit
a8dd94a7e6
|
@ -65,17 +65,17 @@
|
|||
Public Overrides Sub Draw()
|
||||
PreScreen.Draw()
|
||||
|
||||
Dim fontSize As Vector2 = New Vector2(CInt(FontManager.MainFont.MeasureString(_text).X * Scale), CInt(FontManager.MainFont.MeasureString(_text).Y * Scale))
|
||||
Dim fontSize As Vector2 = New Vector2(CInt(FontManager.MainFont.MeasureString(_text).X * Scale * Core.SpriteBatch.InterfaceScale), CInt(FontManager.MainFont.MeasureString(_text).Y * Scale * Core.SpriteBatch.InterfaceScale))
|
||||
|
||||
Canvas.DrawRectangle(windowSize, New Color(0, 0, 0, CInt(140 * _fadeIn)))
|
||||
Dim boxRect = New Rectangle(CInt(windowSize.Width / 2 - _width / 2 - (_width / 10)),
|
||||
CInt(windowSize.Height / 2 - _height / 2 - (_height / 5) * (1 - _fadeIn)),
|
||||
Dim boxRect = New Rectangle(CInt(ScreenSize.Width / 2 - _width / 2 - (_width / 10)),
|
||||
CInt(ScreenSize.Height / 2 - _height / 2 - (_height / 5) * (1 - _fadeIn)),
|
||||
CInt(_width + (_width / 5)),
|
||||
CInt(_height + fontSize.Y))
|
||||
Canvas.DrawRectangle(boxRect, New Color(_backColor.R, _backColor.G, _backColor.B, CInt(255 * _fadeIn)), True)
|
||||
|
||||
Core.SpriteBatch.DrawString(FontManager.MainFont, _text, New Vector2(CInt(windowSize.Width / 2.0F - fontSize.X / 2.0F + 2 * Scale), CInt(boxRect.Y + (boxRect.Height / 2) - fontSize.Y / 2.0F + 2 * Scale)), New Color(_shadowColor.R, _shadowColor.G, _shadowColor.B, CInt(255 * _fadeIn)), 0F, Vector2.Zero, Scale, SpriteEffects.None, 0F)
|
||||
Core.SpriteBatch.DrawString(FontManager.MainFont, _text, New Vector2(CInt(windowSize.Width / 2.0F - fontSize.X / 2.0F), CInt(boxRect.Y + (boxRect.Height / 2) - fontSize.Y / 2.0F)), New Color(_textColor.R, _textColor.G, _textColor.B, CInt(255 * _fadeIn)), 0F, Vector2.Zero, Scale, SpriteEffects.None, 0F)
|
||||
Core.SpriteBatch.DrawInterfaceString(FontManager.MainFont, _text, New Vector2(CInt(windowSize.Width / 2.0F - fontSize.X / 2.0F + 2 * Scale), CInt(boxRect.Y + (boxRect.Height / 2) - fontSize.Y / 2.0F + 2 * Scale)), New Color(_shadowColor.R, _shadowColor.G, _shadowColor.B, CInt(255 * _fadeIn)), 0F, Vector2.Zero, Scale, SpriteEffects.None, 0F)
|
||||
Core.SpriteBatch.DrawInterfaceString(FontManager.MainFont, _text, New Vector2(CInt(windowSize.Width / 2.0F - fontSize.X / 2.0F), CInt(boxRect.Y + (boxRect.Height / 2) - fontSize.Y / 2.0F)), New Color(_textColor.R, _textColor.G, _textColor.B, CInt(255 * _fadeIn)), 0F, Vector2.Zero, Scale, SpriteEffects.None, 0F)
|
||||
End Sub
|
||||
|
||||
Public Overrides Sub Update()
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
_paperClipTexture = TextureManager.GetTexture("Textures\UI\TrainerCard\Paperclip")
|
||||
_papersTexture = TextureManager.GetTexture("Textures\UI\TrainerCard\Papers")
|
||||
target = New RenderTarget2D(GraphicsDevice, _backTexture.Width, _backTexture.Height + _paperClipTexture.Height, False, SurfaceFormat.Color, DepthFormat.Depth24Stencil8)
|
||||
target2 = New RenderTarget2D(GraphicsDevice, Core.windowSize.Width, Core.windowSize.Height, False, SurfaceFormat.Color, DepthFormat.Depth24Stencil8)
|
||||
target2 = New RenderTarget2D(GraphicsDevice, Math.Max(1, Core.windowSize.Width), Math.Max(1, Core.windowSize.Height), False, SurfaceFormat.Color, DepthFormat.Depth24Stencil8)
|
||||
|
||||
If Screen.Level.Surfing = True Then
|
||||
_charTexture = TextureManager.GetTexture("Textures\NPC\" & Core.Player.TempSurfSkin)
|
||||
|
@ -153,7 +153,7 @@
|
|||
|
||||
_cardBatch.Begin()
|
||||
|
||||
_cardBatch.Draw(target, New Rectangle(CInt(Core.ScreenSize.Width / 2 - target.Width / 2) + 42, CInt(60 + _introY), target.Width, target.Height), Nothing, Color.White, _rotation, Vector2.Zero, SpriteEffects.None, 0F)
|
||||
_cardBatch.Draw(target, New Rectangle(CInt(Core.windowSize.Width / 2 - target.Width / 2 * SpriteBatch.InterfaceScale()) + CInt(42 * SpriteBatch.InterfaceScale()), CInt((60 + _introY) * SpriteBatch.InterfaceScale()), CInt(target.Width * SpriteBatch.InterfaceScale()), CInt(target.Height * SpriteBatch.InterfaceScale())), Nothing, Color.White, _rotation, Vector2.Zero, SpriteEffects.None, 0F)
|
||||
|
||||
_cardBatch.End()
|
||||
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
Dim menuTexture As Texture2D
|
||||
Dim _closing As Boolean = False
|
||||
Dim _opening As Boolean = True
|
||||
Private target As RenderTarget2D
|
||||
Private target2 As RenderTarget2D
|
||||
|
||||
Public Sub New(ByVal currentScreen As Screen)
|
||||
Yslide = YslideMAX
|
||||
|
@ -23,6 +25,9 @@
|
|||
Me.Identification = Identifications.SaveScreen
|
||||
Me.PreScreen = currentScreen
|
||||
|
||||
target = New RenderTarget2D(GraphicsDevice, 700, 440, False, SurfaceFormat.Color, DepthFormat.Depth24Stencil8)
|
||||
target2 = New RenderTarget2D(GraphicsDevice, Math.Max(1, Core.windowSize.Width), Math.Max(1, Core.windowSize.Height), False, SurfaceFormat.Color, DepthFormat.Depth24Stencil8)
|
||||
|
||||
Me.mainTexture = TextureManager.GetTexture("GUI\Menus\Menu")
|
||||
Me.menuTexture = TextureManager.GetTexture("GUI\Menus\SaveBook")
|
||||
ChooseBox.Show({Localization.GetString("save_screen_yes"), Localization.GetString("save_screen_no")}, 0, {})
|
||||
|
@ -33,16 +38,26 @@
|
|||
Public Overrides Sub Draw()
|
||||
Me.PreScreen.Draw()
|
||||
|
||||
Dim halfWidth As Integer = CInt(Core.windowSize.Width / 2)
|
||||
Dim halfHeight As Integer = CInt(Core.windowSize.Height / 2)
|
||||
|
||||
Dim Delta_X As Integer = halfWidth - 350
|
||||
Dim Delta_Y As Integer = halfHeight - 220 + Yslide
|
||||
If Core.Player.IsGameJoltSave = True Then
|
||||
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
|
||||
|
||||
With Core.SpriteBatch
|
||||
Dim saveBookBatch = New SpriteBatch(GraphicsDevice)
|
||||
Dim renderBatch = New SpriteBatch(GraphicsDevice)
|
||||
|
||||
Dim halfWidth As Integer = CInt(Core.windowSize.Width / 2)
|
||||
Dim halfHeight As Integer = CInt(Core.windowSize.Height / 2)
|
||||
|
||||
Dim Render_X As Integer = halfWidth - 350
|
||||
Dim Render_Y As Integer = halfHeight - 220 + Yslide
|
||||
|
||||
Dim Delta_X As Integer = 0
|
||||
Dim Delta_Y As Integer = 0
|
||||
GraphicsDevice.SetRenderTarget(target)
|
||||
GraphicsDevice.Clear(Color.Transparent)
|
||||
|
||||
saveBookBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise)
|
||||
With saveBookBatch
|
||||
.Draw(menuTexture, New Rectangle(Delta_X, Delta_Y, 700, 440), Color.White)
|
||||
|
||||
If saveSessionFailed = True Then
|
||||
|
@ -128,7 +143,27 @@
|
|||
.DrawString(FontManager.MainFont, Localization.GetString("save_screen_name") & ": " & Core.Player.Name & Environment.NewLine & Environment.NewLine & Localization.GetString("save_screen_badges") & ": " & Core.Player.Badges.Count.ToString() & Environment.NewLine & Environment.NewLine & Localization.GetString("save_screen_money") & ": " & Core.Player.Money & Environment.NewLine & Environment.NewLine & Localization.GetString("save_screen_time") & ": " & TimeHelpers.GetDisplayTime(TimeHelpers.GetCurrentPlayTime(), True), New Vector2(Delta_X + 400, Delta_Y + 215), Color.DarkBlue)
|
||||
End If
|
||||
End With
|
||||
Screen.ChooseBox.Draw(New Vector2(Delta_X + 115, Delta_Y + 155), False, 1.5F)
|
||||
saveBookBatch.End()
|
||||
GraphicsDevice.SetRenderTarget(target2)
|
||||
GraphicsDevice.Clear(Color.Transparent)
|
||||
|
||||
renderBatch.Begin()
|
||||
|
||||
renderBatch.Draw(target, New Rectangle(CInt(Core.windowSize.Width / 2 - 350 * SpriteBatch.InterfaceScale()), CInt(Core.windowSize.Height / 2 - 220 * SpriteBatch.InterfaceScale() + Yslide), CInt(target.Width * SpriteBatch.InterfaceScale()), CInt(target.Height * SpriteBatch.InterfaceScale())), Nothing, Color.White, 0.0F, Vector2.Zero, SpriteEffects.None, 0F)
|
||||
|
||||
renderBatch.End()
|
||||
GraphicsDevice.SetRenderTarget(Nothing)
|
||||
|
||||
SpriteBatch.Draw(target2, New Vector2(0, 0), Color.White)
|
||||
Dim ChooseBoxPositionOffset As New Vector2(0, 0)
|
||||
Select Case Core.SpriteBatch.InterfaceScale
|
||||
Case 0.5
|
||||
ChooseBoxPositionOffset = New Vector2(-96, 16)
|
||||
Case 2
|
||||
ChooseBoxPositionOffset = New Vector2(-256, -128)
|
||||
End Select
|
||||
|
||||
Screen.ChooseBox.Draw(New Vector2(CInt(Render_X + 115 + Math.Floor(Core.SpriteBatch.InterfaceScale - 1) * ChooseBoxPositionOffset.X), CInt(Render_Y + 155 + Math.Floor(Core.SpriteBatch.InterfaceScale - 1) * ChooseBoxPositionOffset.Y)), False, 1.5F)
|
||||
End Sub
|
||||
|
||||
Public Overrides Sub Update()
|
||||
|
|
Loading…
Reference in New Issue