P3D-Legacy/P3D/Debug/DebugDisplay.vb

100 lines
3.8 KiB
VB.net
Raw Normal View History

2018-02-21 16:54:36 +01:00
Public Class DebugDisplay
''' <summary>
''' Renders the debug information.
''' </summary>
Public Shared Sub Draw()
If Core.CurrentScreen.CanDrawDebug = True Then
Dim isDebugString As String = ""
If GameController.IS_DEBUG_ACTIVE = True Then
isDebugString = " (Debugmode / " & System.IO.File.GetLastWriteTime(System.Reflection.Assembly.GetExecutingAssembly.Location).ToString() & ")"
End If
Dim ActionscriptActive As Boolean = True
If Core.CurrentScreen.Identification = Screen.Identifications.OverworldScreen Then
ActionscriptActive = CType(Core.CurrentScreen, OverworldScreen).ActionScript.IsReady
End If
Dim cameraInformation = ""
If Not Screen.Camera Is Nothing Then
Dim thirdPersonString As String = ""
If Screen.Camera.Name = "Overworld" Then
Dim c As OverworldCamera = CType(Screen.Camera, OverworldCamera)
If c.ThirdPerson = True Then
thirdPersonString = " / " & c.ThirdPersonOffset.ToString()
End If
2018-02-21 16:54:36 +01:00
End If
cameraInformation = Screen.Camera.Position.ToString() & thirdPersonString & Environment.NewLine & Screen.Camera.Yaw & "; " & Screen.Camera.Pitch & Environment.NewLine
2018-02-21 16:54:36 +01:00
End If
Dim s As String = GameController.GAMENAME & " " & GameController.GAMEDEVELOPMENTSTAGE & " " & GameController.GAMEVERSION & " / FPS: " & Math.Round(Core.GameInstance.FPSMonitor.Value, 0) & isDebugString & Environment.NewLine &
cameraInformation &
2018-02-21 16:54:36 +01:00
"E: " & _drawnVertices.ToString() & "/" & _maxVertices.ToString() & Environment.NewLine &
"C: " & _maxDistance.ToString() & " A: " & ActionscriptActive.ToString()
If Core.GameOptions.ContentPackNames.Count() > 0 Then
Dim contentPackString As String = ""
For Each ContentPackName As String In Core.GameOptions.ContentPackNames
If contentPackString <> "" Then
contentPackString &= ", "
End If
contentPackString &= ContentPackName
Next
contentPackString = "Loaded ContentPacks: " & contentPackString
s &= Environment.NewLine & contentPackString
End If
Core.SpriteBatch.DrawInterfaceString(FontManager.MainFont, s, New Vector2(7, 7), Color.Black)
Core.SpriteBatch.DrawInterfaceString(FontManager.MainFont, s, New Vector2(5, 5), Color.White)
End If
End Sub
#Region "RenderDataTracking"
'Values for tracking render data of the level.
Private Shared _drawnVertices As Integer = 0
Private Shared _maxVertices As Integer = 0
Private Shared _maxDistance As Integer = 0
''' <summary>
''' The amount of vertices rendered in the last frame.
''' </summary>
Public Shared Property DrawnVertices() As Integer
Get
Return _drawnVertices
End Get
Set(value As Integer)
_drawnVertices = value
End Set
End Property
''' <summary>
''' The maximum amount of vertices that are present in the current scene.
''' </summary>
Public Shared Property MaxVertices() As Integer
Get
Return _maxVertices
End Get
Set(value As Integer)
_maxVertices = value
End Set
End Property
''' <summary>
''' The distance of the vertex to the camera, that is the furthest away from the camera.
''' </summary>
Public Shared Property MaxDistance() As Integer
Get
Return _maxDistance
End Get
Set(value As Integer)
_maxDistance = value
End Set
End Property
#End Region
End Class