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

Post Reply
User avatar
Pete
Site Admin
Posts: 882
Joined: Sun Dec 07, 2003 9:10 pm
Location: Candor, NY
Contact:

QB45 Draw Command Help

Post by Pete » Mon Aug 08, 2005 6:43 pm

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

User avatar
Rattrapmax6
Veteran
Posts: 1055
Joined: Sun Jan 02, 2005 2:11 pm
Location: At my computer
Contact:

Post by Rattrapmax6 » Mon Aug 08, 2005 7:33 pm

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...
-Kevin (aka:Rattra)
(x.t.r.GRAPHICS)

MystikShadows
Veteran
Posts: 703
Joined: Sun Nov 14, 2004 7:36 am
Contact:

Post by MystikShadows » Mon Aug 08, 2005 7:48 pm

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!

MystikShadows

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

Post by mennonite » Tue Aug 09, 2005 12:15 am

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.

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

Post by Pete » Tue Aug 09, 2005 8:11 am

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.

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

Re: see that's the kind of thing

Post by Xerol » Tue Aug 09, 2005 8:15 am

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.
If you need music composed in MP3, WAV, or MIDI format, please contact me via email.

Xerol's Music - Updated Regularly!

User avatar
{Nathan}
Veteran
Posts: 1169
Joined: Thu Aug 19, 2004 6:08 pm
Location: The wetlands of central Ohio, USA
Contact:

Post by {Nathan} » Tue Aug 09, 2005 8:49 am

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...
Image

MystikShadows
Veteran
Posts: 703
Joined: Sun Nov 14, 2004 7:36 am
Contact:

Post by MystikShadows » Tue Aug 09, 2005 9:08 am

That would be good to have :-)..
When God created light, so too was born, the first Shadow!

MystikShadows

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

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

User avatar
Rattrapmax6
Veteran
Posts: 1055
Joined: Sun Jan 02, 2005 2:11 pm
Location: At my computer
Contact:

Post by Rattrapmax6 » Tue Aug 09, 2005 4:26 pm

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:
-Kevin (aka:Rattra)
(x.t.r.GRAPHICS)

Guest

Re: see that's the kind of thing

Post by Guest » Tue Aug 09, 2005 8:11 pm

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 :)

Post Reply