[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 264: mysqli_fetch_assoc(): Couldn't fetch mysqli_result
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 326: mysqli_free_result(): Couldn't fetch mysqli_result
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4149: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3027)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4149: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3027)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4149: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3027)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4149: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3027)
Pete's QBASIC Site • Rounded Rectangles?
Page 1 of 1

Rounded Rectangles?

Posted: Sat Oct 01, 2005 9:11 pm
by Rocket Boy
Does anyone know how to do this in Qbasic? I've seen it before. It's probably something ridiculously easy... If you don't know, I mean the rectangles with rounded edges, like the buttons in MacOS and stuff like that.

Posted: Sat Oct 01, 2005 9:28 pm
by Zamaster
Well, your gonna need on LINE command and one CIRCLE command. Start off by drawing your box of lines except cut them off by whatever the radius of your rounded circle edges will be. Next, draw the circle at the "would be" intersection point of all the lines(top left, top right, ect...) except only draw sections corresponding with the angles so
top left = 90 to 180
top right = 180 to 270
bottom right = 270 to 0
bottom left = 0 to 90

Im sorry, this is really confusing but I dont feel like actually doing any work :? . Ill hope somebody else gives you some code.

Posted: Sun Oct 02, 2005 8:12 am
by Kyle

Code: Select all

declare sub rbox(x1,y1,x2,y2,c,r)
const pi=3.1415926

screen 12

rbox 50,50,150,150,6,17

sub rbox(x1,y1,x2,y2,c,r)
     
line (x1,y1+r)-(x1,y2-r),c
line (x1+r,y1)-(x2-r,y1),c
line (x2,y1+r)-(x2,y2-r),c
line (x2-r,y2)-(x1+r,y2),c
circle (x1+r,y1+r),r,c,pi*0.5,pi
circle (x2-r,y1+r),r,c,0,pi*0.5
circle (x1+r,y2-r),r,c,pi,pi*1.5
circle (x2-r,y2-r),r,c,pi*1.5
     
end sub
Enjoy

Posted: Sun Oct 02, 2005 3:24 pm
by Rocket Boy
That's a pretty useful sub... but what would you do if you wanted to be able to fill it with color?

Posted: Sun Oct 02, 2005 3:36 pm
by Nodtveidt
Do a floodfill I guess...

Posted: Sun Oct 02, 2005 3:49 pm
by Kyle
Yeah, just a simple paint will do.

Posted: Mon Oct 03, 2005 2:26 pm
by {Nathan}
Kylemc wrote:Yeah, just a simple paint will do.
it seems like some commands (like PAINT, the other use for SCREEN, and and FILE (it is for QB45, just found that out)) are just to underused...

Posted: Mon Oct 03, 2005 4:12 pm
by Kyle
You forgot GOTO :D