Game Development Community

Screen coords to/from t2d coords?

by Luke D · in Torque Game Builder · 05/27/2005 (4:04 pm) · 10 replies

Is there a pre-existing function that will transform T2D world coordinates to screen and vice-versa? For example, setCursorPos takes screen resolution values (e.g. 0x0 - 800x600) whereas my onMouseMove feeds me T2d transformed world coordinates.

This should be fairly easy to implement, but I wanted to make sure I'm not overlooking something already in there.

#1
05/28/2005 (6:57 am)
Yes, there's a suite of functions as described in the doco in fxSceneWindow2D...

getWindowExtents() - Window Extents.
getIsWindowPoint() - World in Window?
getWindowPoint() - Window from World
getCanvasPoint() - Canvas from Window
getWorldPoint() - World from Window

'Window' means the fxSceneWindow2D GUI window and 'Canvas' is the main display window. If the fxSceneWindow2D occupies the whole canvas then the Window/Canvas return identical coords.

- Melv.
#2
05/28/2005 (12:13 pm)
I can't believe I missed those (well actually I saw them but must have mis-interpreted them, or skipped them because the 'Debug modes' table partially obscures the fxSceneWindow2D in my Acrobat Reader for some odd reason), thanks Melv.


Luke
#3
05/29/2005 (1:28 am)
Wierd. Just for my notes; what version of Acrobat Reader are you using? On what OS?

For you information, I used Open-Office v2 to export them to PDF; not sure if there's a known problem with that or not.

- Melv.
#4
05/29/2005 (1:44 am)
Melv, this problem has been reported since the 1.02 release. IIRC the 1.0 docs were fine. I have the same problem with WinXP and Reader 6 and 7.01.

The Debug Modes section is covering the first 7 entries in the fxSceneWindow2D(GUIControl) section.
#5
05/29/2005 (10:57 am)
Indeed, I'm experiencing it with the same configuration/versions as Philip (XP and Reader 6/7).
#6
05/30/2005 (3:26 am)
Hmmm, That's wierd because I've looked at this on the same OS versions as well as AR6/7. Not sure what the inconsistency is here.

I might go out and purchase PDF factory and use that to see if it makes any difference.

- Melv.
#7
05/30/2005 (4:35 am)
Could always give Primo a go: www.primopdf.com/. A freebie PDF creator that works as a printer driver.
#8
05/30/2005 (11:22 am)
Cool,

Thanks for the link.

- Melv.
#9
05/30/2005 (12:41 pm)
I tried "primopdf" and whilst it's nice to get a printer-style pdf output, it doesn't seem to support hyperlinks unfortunately. That's a damn shame because it would have been perfect otherwise. This is identical to the output of OpenOffice 1.1 whereas OpenOffice 2.0 supports it well.

I really don't understand though why there would be an inconsistency in the output. Surely this is what PDF is all about? Oh well, grrrr.

- Melv.
#10
05/30/2005 (2:33 pm)
Now that I look back I've had that same problem with the entries being blocked =/ lol only if everything could be consistent ehh Melv, a shame its giving you such a problem getting the same format and features.