Draws a filled-in rectangle shape.
- The x coordinate of the upper left corner.
- The y coordinate of the upper left corner.
- The x coordinate of the lower right corner.
- The y coordinate of the lower right corner.
- The color of the rectangle and fill. If omitted, the color from the draw state is used.
This draws a rectangle shape parallel to the screen borders.
It's important to note that the coordinates are inclusive, which is to say PICO-8 will render pixels at the right and bottom coords. In many APIs,
y1 would be the first pixels which are not drawn, but on PICO-8, they are the last pixels which are drawn.
-- fill the whole screen, as if we called cls(1) rectfill(0, 0, 127, 127, 1) -- fill the center 96x96 portion of the screen rectfill(16, 16, 111, 111, 1) -- draw three filled-in white rectangles at random locations and sizes color(7) for x=1,3 do rectfill(rnd(128), rnd(128), rnd(128), rnd(128)) end