Draws an empty 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 border. 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.
-- draw a border around the whole screen rect(0, 0, 127, 127, 1) -- draw a border inset by 16 pixels rect(16, 16, 111, 111, 1) -- draw three empty white rectangles at random locations and sizes color(7) for x=1,3 do rect(rnd(128), rnd(128), rnd(128), rnd(128)) end