API Reference › Screen — drawing › Screen.clip
method

Screen.clip

Screen.clip(x, y, width, height)

Restricts all subsequent drawing to the screen-space rectangle (x, y, width, height) — pixels outside it are discarded. Use it to keep a panel's contents inside its frame, mask a minimap, or draw a wipe transition. Call Screen.clip_reset to lift it. The clip rectangle is in screen space, applied after the camera offset.

Example

program Demo {
  handler DrawWorld phase Render {
    Screen.clip(x: 20, y: 20, width: 100, height: 60)
    Screen.fill_rectangle(x: 0, y: 0, width: 320, height: 240, color: Color.Green)
    Screen.clip_reset()
    Screen.show()
  }
}
← All symbols