Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

'Relocating' (x,y) coordinates OR define quads?

Status
Not open for further replies.

Redeemer

Programmer
Jul 7, 2000
1
AU
In response to an answer given by MIGGYD I leave this question in the hands of any who read this. I need to set the (0,0)coordinate to the middle of (640,480) screen 12<br>or (320,240)for a numberplane.<br><br>or<br><br>for LIVED's answer I need to define each quadrant but this is very complex but would probably yeild a better result, please refer to my previous thread for more details!<br><br>any responses please state in detail what I should do, both programmers have been of great help!!!!!! I couldn't have done it without you so far, I will send you the final thing when it is done!<br><br>
 
hmmm its preety simple <br>check out the help file <br>on the window command<br>if you are still stuck<br>sorry i couldnt help<br>
 
I'll send you an email, but just out of curosity, will the negitive numbers be computated as well? or <b>ONLY</b> per user's entry?<br><br>Yes, <font color=red>Live</font>'s suggestion is a good one.&nbsp;&nbsp;But, since you may have the plane in graphics mode <font color=purple>(hint: 640 x 480 -- kinda gives that impression)</font>&nbsp;&nbsp;you might want to consider repositioning the base coordinates to screen center--which by the way is 319 x 239 (not 320 x 240)..remember that the zero (0) in QB is considered to be a valid number instead of NULL...the screen may hold 640 x 480 pixcels <b>BUT</b> they start the count at zero (0) so zero is position #1 and pixcel 1 is position #2...(like the commercial says)...and so on...and so on...and so on.&nbsp;&nbsp;<i>(Sorry, this is the perfectionist side of me talking, I'll try to control myself)</i>.<br><br>I really don't think anybody is going to count pixcels to see if you're in the middle or not; so disregard the above. <p> <br><a href=mailto: > </a><br><a href= > </a><br>Why do gas stations have signs saying No Smoking, yet they sell cigaretes?
 
Below is a sample of what I mean by relocating the origin coordinates (0,0) to the center of the screen.&nbsp;&nbsp;Sorry, I nearly forgot to let you know that in order to do it you must activate WINDOW function...see below<br><br><b>'<br>'Title:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Simple Number Plane<br>'Creator:&nbsp;&nbsp;&nbsp;MiggyD<br>'<br>SCREEN 12&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'Select Screen Mode<br>CLS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'Clear entire screen of garbage<br>VIEW&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'Turn Entire Screen to Graphics Mode<br>CLS 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'Clear entire Graphics from screen (opt'l)<br><font color=red>WINDOW (-319, 239)-(319, -239)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'Redefine 0,0 cordinates to center of scrn</font><br><br>LOCATE 30, 1<br>PRINT &quot;Coordinates 0,0 is now in center of screen&quot;;<br>LINE (0, 0)-(0, 0), 15<br>SLEEP 4<br><br>LINE (0, 0)-(319, 239), 2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'green line from 0 to +x,+y (top right)<br>LOCATE 30, 1<br>PRINT &quot;Coordinates 0,0 to 319,239 in GREEN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;;<br>SLEEP 4<br><br>LINE (0, 0)-(319, -239), 3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'cyan line from 0 to +x,-y (bottom right)<br>LOCATE 30, 1<br>PRINT &quot;Coordinates 0,0 to 319,-239 in CYAN (lite blue-ish)&quot;;<br>SLEEP 4<br><br>LINE (0, 0)-(-319, 239), 4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'red line from 0 to -x,+y (top left)<br>LOCATE 30, 1<br>PRINT &quot;Coordinates 0,0 to -319,239 in RED&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;;<br>SLEEP 4<br><br>LINE (0, 0)-(-319, -239), 5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'magenta line from 0 to -x,-y(bottom left)<br>LOCATE 30, 1<br>PRINT &quot;Coordinates 0,0 to -319,-239 in MAGENTA (purple-ish)&quot;;<br>LINE (0, 0)-(-319, -239), 5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'This redraw line ON TOP OF TEXT<br>SLEEP 4<br><br>ClearKbBuf:<br>FOR x = 1 TO 100<br>&nbsp;&nbsp;&nbsp;&nbsp;Dump$ = INKEY$<br>NEXT x<br><br>InputX:<br>LOCATE 30, 1<br>PRINT STRING$(79, 32);<br>LOCATE 30, 1<br>PRINT &quot;Enter the 'X' coordinate [left to right] (range -319 to 319):&quot;;<br>INPUT ; x<br>IF x &gt; 319 OR x &lt; -319 THEN GOTO InputX<br><br>InputY:<br>LOCATE 30, 1<br>PRINT STRING$(79, 32);<br>LOCATE 30, 1<br>PRINT &quot;Enter the 'Y' coordinate [top to bottom] (range 239 to -239):&quot;;<br>INPUT ; y<br>IF y &gt; 239 OR y &lt; -239 THEN GOTO InputY<br><br>DispInputs:<br>LOCATE 30, 1<br>PRINT STRING$(79, 32);<br>LOCATE 30, 1<br>PRINT &quot;Your input will be displayed in WHITE from 0 to &quot;; STR$(x); &quot;,&quot;; STR$(y);<br>LINE (0, 0)-(x, y), 15, , &HFCF0<br>SLEEP 7<br><br>END</b><br><br>Hope this helps you decide which way to go.&nbsp;&nbsp;Good Luck <p> <br><a href=mailto: > </a><br><a href= > </a><br>Why do gas stations have signs saying No Smoking, yet they sell cigaretes?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top