How was the debug screen programmed in minecraft?
Probably like everything else in Minecraft: with Java
With Java, how the rest of the game?
There's no real command. Debug visualizations are mostly appended to existing code so that, for example, if a variable "debug" has the value "true", it can also be executed. Here is a small code example:
public static boolean overButton (int xl, int yo, int xr, int yu) {
if (Settings.debug) {
fill (Color.RED);
drawRect (xl, yo, (xr-xl), (yu-yo));
}
return (mouseX> xl && mouseX
This method tests whether the mouse pointer is inside a rectangle.
However, if the debug function is activated, a red rectangle with the size of the specified rectangle is also drawn on the screen.
So I can see later if I have set all buttons correctly.
This is only an example of how such a debug function can be installed.
With Minecraft, the whole thing is probably similar, except that in the case of course more information is shown on the screen.
In summary, I would say that debug functions can find their way into a game or program in a variety of ways, and then often in many places within the code.