in BASIC ROM:
|List of all BASIC keywords|
-- Draw box at specified position on screen
Type: Command General Programming-Syntax: BOX [color source], X1,Y1[,X2,Y2][,angle][,paint]]
|color source||0=Background color|
|x1,y1||Top left corner coordinate (scaled)|
|x2,y2||Bottom right corner opposite x1,y1, (scaled), default is the PC location.|
|angle||Rotation in clockwise degrees: default is 0 degrees|
|paint||Paint shape with color:
0 = Do not paint 1 = Paint (default=0)
This statement allows the user to draw a rectangle of any size on the screen. Rotation is based on the center of the rectangle. The pixel cursor (PC) is located at x2, y2 after the BOX statement is executed. The color source number must be a zero (0) or one (1) if in standard bit map, or a 2 or 3 if in multicolor bit map mode. Also see the GRAPHIC command for selecting the appropriate graphic mode to be use with the BOX color source number.
The x and y values can place the pixel cursor at absolute coordinates such as (100,100) or at coordinates relative to previous position( + / - x and + / - y) of the pixel cursor such as (+20, - 10). The coordinate of one axis (x or y) can be relative and the other can be absolute. Here are the possible combinations of ways to specify the x and y coordinates:
|x,y||absolute x, absolute y|
|+/-x,y||relative x, absolute y|
|x,+/-y||absolute x, relativey|
|+/-x, +/-y||relative x, relative y|
Also see the LOCATE command for information on the pixel cursor.
Examples[edit | edit source]
BOX 1, +10, +10
Draw a box 10 pixels to the right and 10 down from the current pixel cursor location
BOX 1, 10, 10, 60, 60
Draws the outline of a rectangle.
BOX , 10, 10, 60, 60, 45, 1
Draws a painted, rotated box (a diamond)
BOX , 30, 90, , 45, 1
Draws a filled, rotated polygon.
Any parameter can be omitted but you must include a comma in its place, as in the last two examples.
Note: Wrapping occurs if the degree is greater than 360.