Custom cursor broken?

Scripting questions, discussions, etc
2 posts Page 1 of 1
Duion
Posts: 1318
Joined: Sun Feb 08, 2015 1:51 am
 
  by Duion » Fri Jun 09, 2017 1:09 pm
Inside the default template there is code to define a custom default cursor that you can modify.
https://github.com/GarageGames/Torque3D ... cs#L34-L38
I tried adding a custom graphic for the cursor, but I noticed that the custom cursor is never loaded, the game will always use the default windows cursor.

So how can I make it work? Or is it never used or cannot work? If so can I delete it?
Hodo33
Posts: 86
Joined: Fri Dec 29, 2017 4:34 pm
by Hodo33 » Tue May 14, 2019 5:56 pm
I recall in the past I had to add
overrideplatformcursor = true in guicanvas.cpp and h I will see if I can find the code

end of guiCanvas.h add this

protected:
bool mOverridePlatformCursor;
public:
void overridePlatformCursor( bool state = true )
{
mOverridePlatformCursor = state;
}

end of guiCanvas.cpp add this

ConsoleMethod( GuiCanvas, overridePlatformCursor, void, 2, 3, "(value=true)" )
{
bool value = true;
if( argc > 2 )
value = dAtob( argv[ 2 ] );
object->overridePlatformCursor( value );
}

in game script files main.cs at the end of createCanvas add this

if (isObject(Canvas))
Canvas.overridePlatformCursor(true);
return true;

in script cursors.cs add the new cursor
new GuiCursor(CrossHairCursor)
{
hotSpot = "8 8";
renderOffset = "0 0";
bitmapName = "core/art/gui/images/crosshair_white";
};

then any time in game script you want a different cursor

function MEvent::onMouseEnter(%this,%b,%point,%m)
{
Canvas.setCursor("CrosshairCursor");
}

Hope this helps...
2 posts Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests