show_debug_overlay


描述

This function can be used to switch on and off the standard debug overlay when testing your game and is disabled by default. The debug overlay shows a graphic CPU/GPU usage bar in the actual game window itself along with the current real fps value, number of texture swaps and the number of vertex batches (note that texture swaps and vertex batches will never be zero and will normally show values of 2 or 3, since even with an empty room an no objects GameMaker Studio 2 still has to draw and batch things).

这个显示栏被分成几个部分,每个部分代表 1/60 秒。As you can see from the image above, the bar is made up of various colours:

Using this function you can add the overlay whether in debug mode or not, and in this way, you can see how efficiently your game runs and get a visual cue as to how it is using the available resources, without the over-head of having the debugger running alongside.


语法:

show_debug_overlay(enable);

参数 描述
enable switch on (true) or off (false) the debug overlay.


返回:

N/A(无返回值)


例如:

if global.debug
   {
   show_debug_overlay(true);
   }
else
   {
   show_debug_overlay(false);
   }

The above code will toggle the debug on or off depending on the value of a global variable.