Page 1 of 1

QB45 Draw Command Help

Posted: Mon Aug 08, 2005 6:43 pm
by Pete
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

Comments: hello
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

Posted: Mon Aug 08, 2005 7:33 pm
by Rattrapmax6
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
Y! = 100 * SIN(RAD!)
X! = 100 * COS(RAD!)

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

PRINT XLOC!; " "; YLOC!
:wink: That should do the trick...

Posted: Mon Aug 08, 2005 7:48 pm
by MystikShadows
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

see that's the kind of thing

Posted: Tue Aug 09, 2005 12:15 am
by mennonite
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.

Posted: Tue Aug 09, 2005 8:11 am
by Pete
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.

Re: see that's the kind of thing

Posted: Tue Aug 09, 2005 8:15 am
by Xerol
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.

Posted: Tue Aug 09, 2005 8:49 am
by {Nathan}
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...

Posted: Tue Aug 09, 2005 9:08 am
by MystikShadows
That would be good to have :-)..

Posted: Tue Aug 09, 2005 4:26 pm
by Rattrapmax6
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.... :roll: :lol:

Re: see that's the kind of thing

Posted: Tue Aug 09, 2005 8:11 pm
by Guest
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 :)