Game Development Community

Mouse pointer image change on the fly

by Andrea Barolo · in Torque Game Engine · 04/17/2008 (2:36 am) · 4 replies

Hello !! We are building our game of flying ships !!

We are wondering if there is a C++ way to change the mouse pointer shape on the fly ,like Silent Hunter 4 map tools !!

#1
04/17/2008 (1:38 pm)
I've only done it in script. You define a guiCursor object with your bitmap and some other properties:
new GuiCursor(DefaultCursor)
{
   hotSpot = "1 1";
   renderOffset = "0 0";
   bitmapName = "./CUR_3darrow";
};
Then whenever you want it to switch you call:
Canvas.setCursor(CursorObjectName);

If you really need to do it in C++ you could simply track down the C++ calls made by those script functions. Shouldn't be difficult at all.
#2
04/21/2008 (3:01 am)
COOL !! Thankz
#3
04/21/2008 (5:26 am)
Handy little bit of script. But may I ask why torque does not support .cur files in this fashion, or perhaps i'm missing something.
#4
04/21/2008 (9:13 am)
Aren't .cur files defined for the Windows "hardware" cursor? It may be that Torque supports .cur files, but I've never tried it personally. The big difference is that Windows Cursors work at a hardware-interrupt level, where's Torque Cursors are simply a bitmap drawn on the frame. As a consequence, the cursor in Torque is limited by the frame rate, whereas the Windows cursor is not.