DrawDiagnostics [x][,y][,maximum]
Parameters
|
x (optional) - left edge of the overlay in pixels; 8 (default) y (optional) - top edge of the overlay in pixels; 8 (default) maximum (optional) - most rows to draw; 0 draws nothing, and a negative value is a runtime error; 6 (default) |
Description
|
Draws the newest diagnostic records as a text overlay on the current buffer. DrawDiagnostics is the one-line window into the diagnostics store: drop it between RenderWorld and Flip and the latest engine news appears on screen. Each row shows the record's level and category, its source, its message, and an "(xN)" suffix when identical events have been folded together - for example: [error][model] media/crate.b3d: Could not load the mesh. Rows are prioritised so the important stuff wins the limited space: errors and warnings come first, newest first, in red and yellow; any rows left over go to information records, in grey. With the default maximum of 6 you get a compact corner readout; raise it while chasing something noisy. The overlay is state-preserving - your current drawing Color, Origin and Viewport are untouched - and it prints with the current font into the current buffer. Rows too long for the screen are trimmed with "...". It is a development overlay: for player-facing error screens, read the records yourself with CountDiagnostics and the getters and present them your way. Requires Extended mode. See also: CountDiagnostics, DiagnosticMessage, ClearDiagnostics, DrawRenderStats. |
Example
; DrawDiagnostics Example ; ----------------------- ; Requires Extended mode. Graphics3D 640,480,0,2 SetBuffer BackBuffer() camera=CreateCamera() PositionEntity camera,0,1,-6 light=CreateLight() RotateEntity light,45,45,0 pad=CreateCylinder() ScaleEntity pad,1.5,0.1,1.5 EntityColor pad,80,200,255 rows=6 While Not KeyDown(1) ; Space and N fail to load different assets, filling the diagnostic store If KeyHit(57) Then enemy=LoadMesh("enemy_model.glb") If KeyHit(49) Then powerup=LoadMesh("powerup_model.glb") ; [ and ] change how many rows the overlay may use If KeyHit(26) And rows>1 Then rows=rows-1 If KeyHit(27) And rows<10 Then rows=rows+1 TurnEntity pad,0,1,0 ; Arrow keys move the camera If KeyDown(200) Then MoveEntity camera,0,0,0.1 If KeyDown(208) Then MoveEntity camera,0,0,-0.1 If KeyDown(203) Then TurnEntity camera,0,1,0 If KeyDown(205) Then TurnEntity camera,0,-1,0 RenderWorld ; DrawDiagnostics paints the newest records without changing drawing state DrawDiagnostics 8,60,rows Text 0,0,"Space / N: fail loads [ / ] : rows Arrows: camera Esc: exit" Text 0,20,"DrawDiagnostics 8,60,"+rows+" ("+CountDiagnostics()+" records stored)" Flip Wend End
Index