## QB45 Draw Command Help

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Pete
Posts: 882
Joined: Sun Dec 07, 2003 9:10 pm
Location: Candor, NY
Contact:

### QB45 Draw Command Help

Hey guys, I got this question in my email, and I'm not familiar with this command. I'd look it up, but I'm in a rush. Any ideas?
jim wrote:name: jim

in quickbasic 4.5 i used to use a function but i cannot remember the name!
when i use the draw command to draw a line say at an angle and 100 long, there is a way of finding out which x and y it has reached.
what is that command?
thanks
Jim

Rattrapmax6
Veteran
Posts: 1055
Joined: Sun Jan 02, 2005 2:11 pm
Location: At my computer
Contact:
Hmm.... DRAW statment, well, for what he wants... He'd need to take the angle at which it was cast, find its SIN()for Y, then times it into the distance travled to get the distance of Y.. then repeat it for X using COS... Then to find the new location, add the distance of X and Y to the old X and Y.. Example, pesido mostly, I never worked with DRAW much...

Code: Select all

``````'Draw line 45deg angle, 100 pixels long

RAD! = 45 * 3.14 / 180

XLOC! = OLDX + X!
YLOC! = OLDY + Y!

PRINT XLOC!; " "; YLOC!``````
That should do the trick...
-Kevin (aka:Rattra)
(x.t.r.GRAPHICS)

Veteran
Posts: 703
Joined: Sun Nov 14, 2004 7:36 am
Contact:
From QB 4.5's online help, this should be what he's looking for.

────────────────────────────────────────────────────────────────────────────

Code: Select all

``````POINT Function Details

Syntax
POINT (x,y)
POINT (number)

The coordinates x and y refer to the pixel being evaluated by the POINT
function. When called with two coordinates, POINT returns the color number
of the indicated pixel. If the specified pixel is out of range, POINT
returns the value -1.

POINT with one argument (as explained in the list below) allows
the user to retrieve the current graphics-cursor coordinates.

Argument   Value Returned
0          The current physical x coordinate.
1          The current physical y coordinate.
2          The current view x coordinate. This returns the same
value as the POINT(0) function if the WINDOW statement
has not been used.
3          The current view y coordinate. This returns the same
value as the POINT(1) function if the WINDOW statement
has not been used.

``````
POINT(0) returns current X
POINT(1) returns current Y
When God created light, so too was born, the first Shadow!

Need hosting? http://www.jc-hosting.net

Interested in Text & ASCII development? Look no further!
http://www.ascii-world.com

mennonite

### see that's the kind of thing

there's a lot of people on this forum (maybe everyone) that know more about programming than i do. and i'm sure you know more about php, css and the like, pete. i'm kind of surprised you didn't know point() but that's just it. sometimes people don't know some really important commands. point is on my tutorial. you might like it / it might be really good after all.

Pete
Posts: 882
Joined: Sun Dec 07, 2003 9:10 pm
Location: Candor, NY
Contact:
I may have used the POINT function in the past, but I've forgotten it.

Remember: I haven't programmed ANYTHING in QB since 1999, or maybe early 2000.

Xerol
Veteran
Posts: 81
Joined: Tue Jan 04, 2005 6:27 pm
Location: Timonium, MD
Contact:

### Re: see that's the kind of thing

mennonite wrote:there's a lot of people on this forum (maybe everyone) that know more about programming than i do. and i'm sure you know more about php, css and the like, pete. i'm kind of surprised you didn't know point() but that's just it. sometimes people don't know some really important commands. point is on my tutorial. you might like it / it might be really good after all.
Well, that's the one thing I don't really like about QB - duplicate definition functions. Especially when you don't have a reference handy (*hugs GWBasic Manual*) it's a bit confusing sometimes. SCREEN in its other use doesn't have much use in graphical programs but for text mode it's really helpful, but I doubt if more than half of QB programmers know about the second usage.

Xerol's Music - Updated Regularly!

{Nathan}
Veteran
Posts: 1169
Joined: Thu Aug 19, 2004 6:08 pm
Location: The wetlands of central Ohio, USA
Contact:
Thats what I love about my QB programing book... I know some things (like how to use a laser light pen for compatable monitors) that others have never even heard of... thats why if I can get my hands on it (workin' hard on it) I am going to upload QB by example...

Veteran
Posts: 703
Joined: Sun Nov 14, 2004 7:36 am
Contact:
That would be good to have ..
When God created light, so too was born, the first Shadow!

Need hosting? http://www.jc-hosting.net

Interested in Text & ASCII development? Look no further!
http://www.ascii-world.com

Rattrapmax6
Veteran
Posts: 1055
Joined: Sun Jan 02, 2005 2:11 pm
Location: At my computer
Contact:
http://www.freebasic.net/wiki/wikka.php?wakka=FBWiki

That might be helpful in some cases. FB has almost 90% of all QB commands, just skip over the new add on's for a nicely made QB help....
-Kevin (aka:Rattra)
(x.t.r.GRAPHICS)

Guest

### Re: see that's the kind of thing

Xerol wrote:SCREEN in its other use doesn't have much use in graphical programs but for text mode it's really helpful, but I doubt if more than half of QB programmers know about the second usage.
ah, yeah, screen being the text mode equiv of the point statement in this post... it covers that too... also yeah, wiki = good. the first big fb program i made by the way, was text mode and used screen... the function you mentioned, not the command