Hi, I have a problems with switching multiple cursors in game.
When I change cursor, it flickers for a moment with default OS cursor, it’s a small thing but I want to remove it.
I have 6 cursors graphics, defined in style .xml file, and a method to change cursors:
void GameMode::ChangeCursor(GameCursorType type)
{
if (currentCursorType == type) return;
currentCursorType = type;
//this will crash \/ \/ \/
//UI* ui = GetSubsystem<UI>();
//Cursor * cursor = ui->GetCursor();
//cursor->SetShape(cursorNames[type]);
//ui->SetCursor(cursor);
//this will flicker cursor \/ \/ \/
UI* ui = GetSubsystem<UI>();
SharedPtr<Cursor> cursor = SharedPtr<Cursor>(new Cursor(context_));
cursor->SetStyleAuto(ui->GetRoot()->GetDefaultStyle());
cursor->SetShape(cursorNames[type]);
ui->SetCursor(cursor);
}
I tried to change cursor at the end of the frame but that didn’t help.