P3D-Legacy/P3D/Screens/MainMenu/SplashScreen.vb

84 lines
2.9 KiB
VB.net
Raw Normal View History

Imports System.Threading
''' <summary>
''' This is the game screen that includes the MonoGame logo and the relevant license text.
''' </summary>
Friend Class SplashScreen
2016-09-07 18:50:38 +02:00
Inherits Screen
2018-01-07 19:44:27 +01:00
Private Const LICENSE_TEXT As String =
"""MonoGame"", the MonoGame Logo, and its source code are copyrights of MonoGame Team (monogame.net).
Pokémon 3D is not affiliated with The Pokémon Company, Nintendo, Creatures inc. or GAME FREAK inc.
Please support the official release!"
Private ReadOnly _monoGameLogo As Texture2D
Private ReadOnly _licenseFont As SpriteFont
Private ReadOnly _licenseTextSize As Vector2
2016-09-07 18:50:38 +02:00
Private _delay As Single = 7.0F
Private _loadThread As Thread
Private _startedLoad As Boolean
Private _game As GameController
2016-09-07 18:50:38 +02:00
Public Sub New(ByVal GameReference As GameController)
_game = GameReference
CanBePaused = False
CanMuteMusic = True
CanChat = False
CanTakeScreenshot = True
2018-09-11 15:52:38 +02:00
CanDrawDebug = False
MouseVisible = False
CanGoFullscreen = True
_monoGameLogo = TextureManager.LoadDirect("GUI\Logos\MonoGame.png")
_licenseFont = Core.Content.Load(Of SpriteFont)("Fonts\BMP\mainFont")
_licenseTextSize = _licenseFont.MeasureString(LICENSE_TEXT)
2016-09-07 18:50:38 +02:00
Me.Identification = Identifications.SplashScreen
End Sub
Public Overrides Sub Draw()
Canvas.DrawRectangle(Core.windowSize, Color.Black)
Core.SpriteBatch.Draw(_monoGameLogo, New Vector2(CSng(Core.windowSize.Width / 2 - _monoGameLogo.Width / 2),
CSng(Core.windowSize.Height / 2 - _monoGameLogo.Height / 2 - 50)), Color.White)
2016-09-07 18:50:38 +02:00
Core.SpriteBatch.DrawString(_licenseFont, LICENSE_TEXT, New Vector2(CSng(Core.windowSize.Width / 2 - _licenseTextSize.X / 2),
CSng(Core.windowSize.Height - _licenseTextSize.Y - 50)), Color.White)
2016-09-07 18:50:38 +02:00
End Sub
Public Overrides Sub Update()
If _startedLoad = False Then
_startedLoad = True
2016-09-07 18:50:38 +02:00
_loadThread = New Thread(AddressOf LoadContent)
_loadThread.Start()
2016-09-07 18:50:38 +02:00
End If
If _loadThread.IsAlive = False Then
If _delay <= 0.0F Or GameController.IS_DEBUG_ACTIVE = True Then
2016-09-07 18:50:38 +02:00
Core.GraphicsManager.ApplyChanges()
Logger.Debug("---Loading content ready---")
If MapPreviewScreen.MapViewMode = True Then
Core.SetScreen(New MapPreviewScreen())
Else
Core.SetScreen(New PressStartScreen())
2016-09-07 18:50:38 +02:00
End If
'Core.SetScreen(New TransitionScreen(Me, New IntroScreen(), Color.Black, False))
2016-09-07 18:50:38 +02:00
End If
End If
_delay -= 0.1F
2016-09-07 18:50:38 +02:00
End Sub
Private Sub LoadContent()
Logger.Debug("---Start loading content---")
Core.LoadContent()
End Sub
End Class