BBC BASIC for Windows
Programming >> Graphics and Games >> convert coords text ,,graphic
http://bb4w.conforums.com/index.cgi?board=graphics&action=display&num=1264632560

convert coords text ,,graphic
Post by leslie griffin on Jan 27th, 2010, 9:49pm

mode 14
rem 160,,x,,64...1280..x..1024.........2560.. x..2048
print 2560/160
rem chr x = 16 graph units
print 2048/64
rem chr y = 32 graph units
rem graphic 0,0 is bottom left of screnn
rem text 0,0 is top left of screen
brains gone numb
anyone got a simple formula for converting text to graphic co-ords and vice versa, I tend to use mode 14 alot as detailed above......thx
Re: convert coords text ,,graphic
Post by admin on Jan 27th, 2010, 10:18pm

Quote:
anyone got a simple formula for converting text to graphic co-ords and vice versa

If you're trying to align text and graphics you probably should be using the VDU 5 (write text at graphics cursor) mode, so you can use the same coordinate system for both.

Failing that you can find conversion functions between BBC BASIC graphics units and Windows pixel units here:

http://bb4w.wikispaces.com/Converting+graphics+coordinates

You may be able to use those to convert to text coordinates by dividing by the character width and height values (@vdu%!216 and @vdu%!220).

Richard.
Re: convert coords text ,,graphic
Post by leslie griffin on Jan 27th, 2010, 10:40pm

thx for the reply and help.....much appreciated.

leslie griffin.