How to display mouse cusrsor from C++?

,

What is the “official” way to display to mouse cursor when running the game (think RTS style)? I’ve seen your RTS camera example, but that uses some LuaShine classes, and I didn’t really get how I would do something similar in my own component.

Also, how can I change the cursor icon?

Hi Rastar.

MyClass.cpp

	.......................
#include "IHardwareMouse.h"
.......................
void MyClass::SetCursor()
{
AZStd:string cursorFilePath = "/assets/ui/defaultCursor.dds";
gEnv->pHardwareMouse->SetCursor(cursorFilePath.c_str());
}
void MyClass::ShowMouseCursor(bool showMouseCursor)
{
static bool isShowCursor = false;
if (showMouseCursor)
{
if (!isShowCursor)
{
isShowCursor = true;
gEnv->pHardwareMouse->IncrementCounter();
}
}
else
{
if (isShowCursor)
{
isShowCursor = false;
gEnv->pHardwareMouse->DecrementCounter();
}
}
}
...............

Hope this helped to you :slight_smile: