Game Development Community

T3D and Cursors

by J.C. Smith · in Torque 3D Professional · 05/29/2009 (6:50 am) · 5 replies

I'm not sure if this is a bug, missing feature, or if I'm just not doing things right. But I've been trying to use a custom cursor in Torque 3D. I see where it sets up the DefaultCursor, and I've tried replacing it with a new image. I can see the image briefly, but then it goes back to the system cursor. Canvas.setCursor doesn't seem to have any effect either. Is there a different way to do this?

#1
05/29/2009 (7:03 am)
Have you tried the TGEA resource for custom platform cursors?

I have not tried this in T3D, but in TGEA, there are two distinct cursor systems, platform cursors (HW/OS cursors) and GUICursor (a sw cursor). In TGEA then platform cursors are enabled by default (although calling setMouseLocked seems to switch to GuiCursor).

So If you don't want the mouse locked to the window, I would try and merge in this TGEA resource for custom platform cursors

http://www.garagegames.com/community/resources/view/15453

Matt
#2
05/29/2009 (9:56 am)
I have this working at home with a custom cursor, so if you haven't figured this out by this evening I'll post what I've got at home... but IIRC, it was something like:

setCursor('YourCustomCursor');
$cursorControlled = false
lockmouse(true);

And if this is on the playGui, I'm going to assume you've already removed .noCursor = "1"?
#3
05/29/2009 (6:27 pm)
I'm sorry for the slow response, time difference here, I just woke up. I'll give that a try. The NoCursor is removed already but didn't try the mouselocking. Will give it a go after I finish up with work.

Update: Lockmouse works. It is slightly annoying in that you will have to alt-tab if you are in windowed mode to get out of the app. Performance is pretty low on the software cursor though and when holding the right mouse down to look it loses focus and you lose the cursor. Probably will need to use the first suggestion and implement hardware cursors.
#4
05/29/2009 (10:47 pm)
I implemented the platform cursor resource with no problems today. Only change necessary was the core/unicode.h being moved to core/string/unicode.h. This works much better, performance is better. It does lose the cursor when you move out of the window. Though that should be simple to fix up by putting some code in the regain focus area. Haven't looked at that yet, but I'm guessing a simple change.
#5
06/22/2012 (1:26 pm)
Thanks Tim Dix as I was having the same problem as well.