Fandom

Pico-8 Wiki

Clip

162pages on
this wiki
Add New Page
Comments0 Share
clip( x, y, w, h )

Sets the clipping region in the draw state.

x
The x coordinate of the upper left corner of the clipping rectangle.
y
The y coordinate of the upper left corner of the clipping rectangle.
w
The width of the clipping rectangle, in pixels.
h
The height of the clipping rectangle, in pixels.

When the draw state has a clipping rectangle set, all draw operations will not affect any pixels in the graphics buffer outside of this rectangle. This is useful for reserving parts of the screen

When called without arguments, the function resets the clipping region to be the entire screen.

Examples Edit

-- set the clipping region to exclude 8 pixels at the top and bottom
clip(0, 8, 128, 116)

-- these circles are clipped
circfill(10, 10, 8, 8)
circfill(10, 118, 8, 8)

-- reset the clipping region to full screen
clip()

-- these circles are not clipped
circfill(40, 10, 8, 7)
circfill(40, 118, 8, 7)
clip example

See also Edit

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.