Game Development Community

Returning mouse coords via function

by Jeff Trier · in Torque Game Builder · 01/16/2007 (12:19 pm) · 3 replies

Hi all,

I am having it so a square sprite target image highlights the tile that your mouse is over within a sceneWindow. So far it appears when you move the mouse into the sceneWindow2D via "sceneWindow2D::onMouseEnter", and moves fine when you move the mouse via "sceneWindow2D::onMouseMove", but...

When my mouse is resting over the sceneWindow2D object, and I use the arrow keys to move the camera around the layer, the target sprite does not hop to where the new tile is that my mouse is now hovering over. I know this is because currently I am using functions that require mouse movement... so I wonder, is there a function that just returns the mouse pointers position over a sceneWindow, so that I can just call that to position the sprite to where the mouse is resting after the player moves the camera?

I searched the docs (which there are a lot of), and I couldn't find an answer.

I hope that made sense.

Thanks guys and gals!
-Jeff

About the author

Originally a Classical/Metal musician, I've always been attracted to anything involving computers, including: Networking, PC Building and Repair, software design and coding. I've been involved with game design and development for over 10 years.


#1
01/16/2007 (10:20 pm)
t2dSceneWindow::getMousePosition()

Purpose
Gets the position of the mouse in world space.

Return Value - Vector
The position of the mouse.

Enjoy!
#2
01/17/2007 (6:51 am)
Wow! Thanks!

How the heck did I miss that? lol ^.^
#3
01/18/2007 (3:02 pm)
Oh... I see why I didn't see it. I am using the T2D version of TGB. I guess I will have to merge my project old into TGB.

::EDIT::
Nevermind, it's in this version too... I just didn't get it working.

Thanks!

-Jeff