Author |
Topic: POS,VPOS convert to graphics position? (Read 551 times) |
|
5against4
New Member
member is offline


Posts: 16
|
 |
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!
|
|
Logged
|
|
|
|
rtr2
Guest
|
 |
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: 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.
|
|
Logged
|
|
|
|
5against4
New Member
member is offline


Posts: 16
|
 |
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 » |
Logged
|
|
|
|
DDRM
Administrator
member is offline


Gender: 
Posts: 321
|
 |
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
|
|
Logged
|
|
|
|
5against4
New Member
member is offline


Posts: 16
|
 |
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!
|
|
Logged
|
|
|
|
|