Difference between revisions of "PixelDisplay.clear"

From MiniScript Wiki
Jump to navigation Jump to search
(Created page with "<c>PixelDisplay.clear</c> clears, resets, and resizes this pixel display. === Arguments === {| class="wikitable" |- ! Parameter Name !! Type !! Default Value !! Meaning...")
 
(Add "Examples")
 
(2 intermediate revisions by one other user not shown)
Line 11: Line 11:
 
| ''width'' || number || 960 || new display width
 
| ''width'' || number || 960 || new display width
 
|-
 
|-
| ''height'' || number || default 640 || new display height
+
| ''height'' || number || 640 || new display height
 
|}  
 
|}  
  
 
=== Usage Notes ===
 
=== Usage Notes ===
 
In addition to clearing the color and setting the size, this method
 
In addition to clearing the color and setting the size, this method
also resets the scale to 1, and scrollX and scrollY to 0.
+
also resets the scale to 1, and scrollX and scrollY to 0. If you wish to clear only the color without resetting scale and scroll, use something like:
 +
 
 +
<ms>gfx.fillRect 0, 0, gfx.width, gfx.height, myColor</ms>
 +
 
 +
=== Examples ===
 +
<ms>clear
 +
 
 +
gfx.fillRect 10,10,700,600,"#aaaaaa"    // Draw rect
 +
 
 +
wait 1
 +
 
 +
gfx.clear "#556677", 100, 100    // Clear window and set window size 100x100
 +
gfx.fillRect 10,10,700,600,"#aaaaaa"    // Draw same rect on resize window </ms>
  
 
[[Category:Mini Micro]]
 
[[Category:Mini Micro]]

Latest revision as of 19:01, 28 January 2025

PixelDisplay.clear clears, resets, and resizes this pixel display.

Arguments

Parameter Name Type Default Value Meaning
color color color.clear color to fill the display with
width number 960 new display width
height number 640 new display height

Usage Notes

In addition to clearing the color and setting the size, this method also resets the scale to 1, and scrollX and scrollY to 0. If you wish to clear only the color without resetting scale and scroll, use something like:

gfx.fillRect 0, 0, gfx.width, gfx.height, myColor

Examples

clear

gfx.fillRect 10,10,700,600,"#aaaaaa"    // Draw rect

wait 1

gfx.clear "#556677", 100, 100    // Clear window and set window size 100x100
gfx.fillRect 10,10,700,600,"#aaaaaa"    // Draw same rect on resize window