On Mon, 02 Oct 2006 23:06:00 +0100, P Witte <[EMAIL PROTECTED]>  
wrote:

> Rich Mellor writes:
>
>> Now, if you had the SBASIC/SuperBASIC Reference Manual, you would be  
>> able
>> to find out this weird and wonderful information (ok enough of the  
>> plug).
>>
>> As we cannot post attachments to the list, I have placed a copy of the
>> description from the Reference Manual at:
>> http://www.rwapsoftware.co.uk/DOC/SCALE.zip
> <>
>>> Given that by default the top edge of the window is 100 in the graphics
>>> coordinate system, how do I find out what the right hand edge  
>>> coordinate
>>> is,
>>> based on the size of the window? Is this the same across platforms? The
>>> figures I get dont appear to make sense!
>
> Thanks Rich, but I fear things have moved on. Your example program  
> doesnt do
> it for QPC2 on a 1280x768 screen. I can find a new "line_diff" which  
> makes
> it work for that screen size, but then it wont work on a 1660x1050  
> screen.
> Im sure there is a formula out there, but at present I cant find it.


OK Per, if you want the real answer on how to do this on QPC2 etc, I will  
let you know how Q-Route does it (now here is a secret) - I rewrote BASIC  
versions of all the graphics commands I needed to allow access to them  
using the absolute co-ordinate system:

The following takes absolute co-ordinates and converts them to the current  
graphics co-ordinate system:

2000 WINDOW #2,512,256,0,0
2010 graf_scale=100:SCALE #2,graf_scale,0,0
2020 window_x%=0:window_y%=0:window_h%=256:window_w%=256
2024 wind_scalex=(1/window_w%)*(graf_scale*(100/window_h%*window_w%/135.5))
2028 wind_scaley=(1/window_h%)*graf_scale

Now having set it up, we can convert absolute co-ords to graphics co-ords  
(remembering that one is upside down to the other),

3512 DEFine PROCedure RFLINE(linex1,liney1,linex2,liney2)
3516 LINE #2,linex1*wind_scalex,(window_h%-liney1)*wind_scaley TO  
linex2*wind_scalex,(window_h%-liney2)*wind_scaley
3520 END DEFine

The constant 135.5 is close enough to the constant mentioned in the  
Reference Manual - it is just a matter of scaling the display to 512x256
-- 
Rich Mellor
RWAP Services
URL:http://www.rwapsoftware.co.uk
URL:http://www.rwapadventures.com
URL:http://www.rwapservices.co.uk
URL:http://www.internetbusinessangels.com

_______________________________________________
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm

Reply via email to