mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-15 01:24:45 +02:00
change hardware cursor to software cursor when joystick available
This commit is contained in:
@ -57,6 +57,7 @@ CursorHandler::CursorHandler()
|
||||
cursor->preload();
|
||||
|
||||
set(Cursor::Map::POINTER);
|
||||
showType = dynamic_cast<CursorSoftware *>(cursor.get()) ? Cursor::ShowType::SOFTWARE : Cursor::ShowType::HARDWARE;
|
||||
}
|
||||
|
||||
CursorHandler::~CursorHandler() = default;
|
||||
@ -290,3 +291,32 @@ void CursorHandler::show()
|
||||
cursor->setVisible(true);
|
||||
}
|
||||
|
||||
Cursor::ShowType CursorHandler::getShowType()
|
||||
{
|
||||
return showType;
|
||||
}
|
||||
|
||||
void CursorHandler::ChangeCursor(Cursor::ShowType showType)
|
||||
{
|
||||
if(this->showType == showType)
|
||||
return;
|
||||
|
||||
switch(showType)
|
||||
{
|
||||
case Cursor::ShowType::SOFTWARE:
|
||||
cursor.reset(new CursorSoftware());
|
||||
showType = Cursor::ShowType::SOFTWARE;
|
||||
cursor->setImage(getCurrentImage(), getPivotOffset());
|
||||
break;
|
||||
case Cursor::ShowType::HARDWARE:
|
||||
cursor.reset(new CursorHardware());
|
||||
showType = Cursor::ShowType::HARDWARE;
|
||||
cursor->setImage(getCurrentImage(), getPivotOffset());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
const Point & CursorHandler::getCursorPosition()
|
||||
{
|
||||
return cursor->getCursorPosition();
|
||||
}
|
||||
|
Reference in New Issue
Block a user