a2SetClip

This command limits Advanced 2D draw operations to a defined area of the screen.

  Syntax
a2SetClip x1, y1, x2, y2
  Parameters
x1
Integer
This value specifies the top left corner X coordinate of the drawing area.
y1
Integer
This value specifies the top left corner Y coordinate of the drawing area.
x2
Integer
This value specifies the bottom right corner X coordinate of the drawing area.
y2
Integer
This value specifies the bottom right corner Y coordinate of the drawing area.

  Returns

This command does not return a value.

  Description

The command requires the top left and bottom right coordinates of a clipping box that limits Advanced 2D draw operations to a defined area of the screen.

  Example Code
a2SetClip 100, 100, screen width() - 100, screen height() - 100

for a = 1 to 1000
    x1 = rnd(screen width())
    y1 = rnd(screen height())
    x2 = rnd(screen width())
    y2 = rnd(screen height())
    color1 = rgb(rnd(255), rnd(255), rnd(255))
    color2 = rgb(rnd(255), rnd(255), rnd(255))
    a2Line x1, y1, x2, y2, color1, color2
next a

rem Reset the clipping area
a2ResetClip

for a = 1 to 100
    x1 = rnd(screen width())
    y1 = rnd(screen height())
    color = rgb(rnd(255), rnd(255), rnd(255))
    a2Circle x1, y1, 50, color
next a

WAIT KEY
  See also

a2ResetClip
Advanced 2D Index
Main Menu