A rather simplistic code, this allows you to create the rounded rectangles often used in such RPG Menus as Final Fantasy and Chrono Trigger, back in the early days.
It doesn't actually draw a rounded rectangle from scratch, rather it generates four circles, the overlapping rectangles, and adds lines on the outside.
"crc" is the "roundness" of the edge. Depending on your project, you may want to set this parameter to a default of some kind.
At the moment it always draws them in blue with a white outline, feel free to change as you will.
If you ever use it, please credit me. Also link to your project because I'd be THRILLED to see it.
For the adventurous semi-newbie, you might want to try to blend this will my RPG Progress Bars to create expanding boxes.
EDIT: One last little thing- due to the way the boxes are drawn, some smaller boxes won't work for certain values of crc. There is no real way to rectify this except by lowering your crc value. Sorry.
//Color Constants By Mr. 909
#CONSTANT col_white RGB(255,255,255)
#CONSTANT col_black RGB(0,0,0)
///RGB Color Constants
#CONSTANT col_blue RGB(0,0,255)
round_rect(6,16,16,256,256)
x1=32
y1=32
x2=240
y2=64
FOR a=1 TO 3
round_rect(6,x1,y1,x2,y2)
INC y1,34
INC y2,34
NEXT a
WAIT KEY
END
FUNCTION round_rect(crc,x1,y1,x2,y2)
//Draw the four exterior circles
//UL
INK col_white,col_black
CIRCLE x1+crc,y1+crc,crc
FILL CIRCLE x1+crc,y1+crc,crc,col_blue
//UR
INK col_white,col_black
CIRCLE x2-crc,y1+crc,crc
FILL CIRCLE x2-crc,y1+crc,crc,col_blue
//DL
INK col_white,col_black
CIRCLE x1+crc,y2-crc,crc
FILL CIRCLE x1+crc,y2-crc,crc,col_blue
//DR
INK col_white,col_black
CIRCLE x2-crc,y2-crc,crc
FILL CIRCLE x2-crc,y2-crc,crc,col_blue
//Draw The Overlay Boxes
INK col_blue,col_black
BOX x1+crc,y1,x2-crc,y2
BOX x1,y1+crc,x2,y2-crc
//Draw The Overlay Lines
INK col_white,col_black
//TB
LINE x1+crc,y1,x2-crc,y1
LINE x1+crc,y2,x2-crc,y2
//LR
//Note-One was added to fix an occasional glitch with lengths. May or may not be a consistent problem.
LINE x1,y1+crc,x1,y2-crc+1
LINE x2,y1+crc,x2,y2-crc+1
ENDFUNCTION