Game Development Community

Dynamic cursor modification based on the 3d object beneath it.

by Cameron Aycock · in Torque Game Engine · 05/03/2004 (8:38 am) · 4 replies

I was wondering if anyone has forged ahead into some code that would allow one to modify the cursor based on what 3d object is beneath it. I am still learning all the GUI controls, as I have been avoiding them until now.

I found that the world editor does this very thing. If you use the inspector, you can see that the cursor changes to a hand us you MouseOver a bot.

I was looking or some type of MouseOver event or something, but couldn't find anythig. I found the cursor's png file and datablock definition in cursors.cs in common, but when I searched for the datablock's usage, I couldn't find anything other than that declaration.

Does anyone know how this is used? What is the proper way to handle this? Can you point me in the right direction?

#1
05/03/2004 (12:07 pm)
I would imagine that what your looking for is in the engine itself and not the cs files. I browsed through the editor cc and .h files and noticed a bunch of selection routines. What your looking for might be in there somewhere under worldeditor.cc and .h. Not sure if this is what your looking for.
#2
05/03/2004 (12:51 pm)
I am afraid you are right... sheesh.... line 1707 in WorldEditor.cc

setCursor(ArrowCursor);
mHitInfo.obj = 0;

//
mUsingAxisGizmo = false;
if(collideAxisGizmo(event))
{
setCursor(HandCursor);


I will probably have to implement this in the GameTSCtrl. Unless someone knows of already exposed MouseMove events for this control? ;)
#3
05/04/2004 (1:19 am)
The Canvas has a setCursor function
Canvas.setCursor(Cursor1);
So, you can change the cursor also using scripts.
But, if you are looking for a method that tells you over wich object the cursor is, I think this method doesn't exist, you have to create it. There should be an old resource about mouse object selection or something like that you can start from there
Hmm, if I remember well I saw some portion of that resource already in the HEAD, perhaps it is already in, but your best bet is to find that resource

Edit:
it should be this click here
Oh, well I almost forgot, more than one year ago I made a new gui cursor class that was able also to show animated cursor and load directly .cur,.ico and .ani files (a question to linux user: .cur,.ico,.ani are files used also in Linux or are win specific?)
#4
05/05/2004 (11:58 am)
Thanks for the input! I have had the object selection working, and can set the cursor, it was really the mouseover events I needed. I think I can just override the mouseover fromt the GuiTSCtrl control as the EditTsCtrl and the WorldEditor does, unless there is another canvas object that can already handle it. Based on the code hierarchy diagrams, there is not. When I get this working I will create a resource for it. Basically I will try to add the code to the GameTSCtrl object for MouseOver responses.