Clear

From MiniScript Wiki
Jump to navigation Jump to search

In Mini Micro, clear is a commonly-used function to clear the screen and reset the displays to their default modes, as shown below.

DisplayLayout.png

clear also reassigns the text and gfx globals to display(3) and display(5) respectively, and moves the text cursor to row 25 (top of the screen).

The clear method is defined in /sys/startup.ms.

Usage Notes

Because clear changes all eight display modes back to their default modes, it makes no sense to set up some other display type (for example a TileDisplay) that you want to use and then call clear. Doing so would just switch off the display you had set up. Moreover, clear does not clear non-standard displays; it only turns them off.

As a result of the above, in most programs clear should be called very early in the program, and certainly before you start setting up any displays.

PixelDisplay, TextDisplay, TileDisplay, and SpriteDisplay all have a .clear method you can call to clear/reset just that one display.