BBC BASIC for Windows
« POS,VPOS convert to graphics position? »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 11:08pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: POS,VPOS convert to graphics position?  (Read 550 times)
5against4
New Member
Image


member is offline

Avatar




PM


Posts: 16
xx POS,VPOS convert to graphics position?
« Thread started on: Jul 1st, 2015, 11:30am »

Is it possible to convert the values acquired by POS and VPOS into x,y graphics coordinates? My gut feeling is that this is problematic due to the variance brought about by different fonts/sizes, but if there's a way i'd love to know.

Thanks!
User IP Logged

rtr2
Guest
xx Re: POS,VPOS convert to graphics position?
« Reply #1 on: Jul 1st, 2015, 12:05pm »

on Jul 1st, 2015, 11:30am, 5against4 wrote:
Is it possible to convert the values acquired by POS and VPOS into x,y graphics coordinates?

The conversion is pretty straightforward, and particularly so if you have not changed either the text or graphics viewport from its default of filling the entire client area. In that simple case the conversion from POS to horizontal graphics coordinate is:

Code:
      x = 2 * POS * @vdu%!216 

The conversion from VPOS to vertical graphics coordinate is almost as simple except that you must take account of the fact that the origins are in different places:

Code:
      y = 2 * (@vdu%!212 - 1 - VPOS * @vdu%!220) 

If you have redefined either the text or graphics viewport, or you have moved the graphics ORIGIN, then you will need to take that into account. Writing a function which automatically compensates for all these factors wouldn't be difficult, but I will leave that as an exercise for the reader.

It should be noted that needing to perform this conversion is pretty unusual. Wouldn't you be better off using the VDU 5 'print text at graphics coordinates' mode so that POS and VPOS aren't involved at all?

Richard.
User IP Logged

5against4
New Member
Image


member is offline

Avatar




PM


Posts: 16
xx Re: POS,VPOS convert to graphics position?
« Reply #2 on: Aug 25th, 2015, 10:47am »

A very belated reply!

Thanks for your response, which was helpful.

You mentioned using VDU5, but is there a way to use the FULL width of the screen? When i've experimented with VDU5, beyond x=3200 isn't possible, and for what i'm working on i need the entire width of the screen (specifially, i'm working in the far right of the screen at the moment, so i definitely need that area). If there's a way to access that extra space, please let me know - thanks!

EDIT: Having looked a little further, this seems to be because the highest resolution mode only has a width of 1600px (=3200 graphics units). Is there a way to utilise 1920px width?

EDIT EDIT(!): Would you recommend this as a decent solution?

Code:
VDU 23,22,1920;1080;8,18,16,0 

or is there a different method you'd recommend instead?
« Last Edit: Aug 25th, 2015, 8:55pm by 5against4 » User IP Logged

DDRM
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 321
xx Re: POS,VPOS convert to graphics position?
« Reply #3 on: Aug 30th, 2015, 5:45pm »

Hi There,

I don't think Richard is currently monitoring this site: he would probably be the best person to help. You could try emailing him direct.

If you look in the "help" you will find a section on "using the entire screen", which might be useful. Alternatively/as well, defining a custom mode seems a sensible approach, but remember that the maximum you can normally define is 1920x 1440, though there is a workround even for that in the Help, linked to from the section above.

Best wishes,

D
User IP Logged

5against4
New Member
Image


member is offline

Avatar




PM


Posts: 16
xx Re: POS,VPOS convert to graphics position?
« Reply #4 on: Sep 1st, 2015, 10:07am »

Thanks DDRM - i wasn't aware Richard wasn't around at the moment. Since posing the question my approach has worked perfectly! smiley
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls