mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-17 01:32:21 +02:00
Update client/eventsSDL/InputSourceGameController.cpp
Co-authored-by: Ivan Savenko <saven.ivan@gmail.com>
This commit is contained in:
@ -199,10 +199,10 @@ void InputSourceGameController::tryToConvertCursor()
|
|||||||
assert(CCS->curh);
|
assert(CCS->curh);
|
||||||
if(CCS->curh->getShowType() == Cursor::ShowType::HARDWARE)
|
if(CCS->curh->getShowType() == Cursor::ShowType::HARDWARE)
|
||||||
{
|
{
|
||||||
int ScaleFactor = GH.screenHandler().getScalingFactor();
|
int scalingFactor = GH.screenHandler().getScalingFactor();
|
||||||
const Point & cursorPosition = GH.getCursorPosition();
|
const Point & cursorPosition = GH.getCursorPosition();
|
||||||
CCS->curh->changeCursor(Cursor::ShowType::SOFTWARE);
|
CCS->curh->changeCursor(Cursor::ShowType::SOFTWARE);
|
||||||
CCS->curh->cursorMove(cursorPosition.x * ScaleFactor, cursorPosition.y * ScaleFactor);
|
CCS->curh->cursorMove(cursorPosition.x * scalingFactor, cursorPosition.y * scalingFactor);
|
||||||
GH.input().setCursorPosition(cursorPosition);
|
GH.input().setCursorPosition(cursorPosition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -227,13 +227,13 @@ void InputSourceGameController::doCursorMove(int deltaX, int deltaY)
|
|||||||
return;
|
return;
|
||||||
const Point & screenSize = GH.screenDimensions();
|
const Point & screenSize = GH.screenDimensions();
|
||||||
const Point & cursorPosition = GH.getCursorPosition();
|
const Point & cursorPosition = GH.getCursorPosition();
|
||||||
int ScaleFactor = GH.screenHandler().getScalingFactor();
|
int scalingFactor = GH.screenHandler().getScalingFactor();
|
||||||
int newX = std::min(std::max(cursorPosition.x + deltaX, 0), screenSize.x);
|
int newX = std::min(std::max(cursorPosition.x + deltaX, 0), screenSize.x);
|
||||||
int newY = std::min(std::max(cursorPosition.y + deltaY, 0), screenSize.y);
|
int newY = std::min(std::max(cursorPosition.y + deltaY, 0), screenSize.y);
|
||||||
Point targetPosition{newX, newY};
|
Point targetPosition{newX, newY};
|
||||||
GH.input().setCursorPosition(targetPosition);
|
GH.input().setCursorPosition(targetPosition);
|
||||||
if(CCS && CCS->curh)
|
if(CCS && CCS->curh)
|
||||||
CCS->curh->cursorMove(GH.getCursorPosition().x * ScaleFactor, GH.getCursorPosition().y * ScaleFactor);
|
CCS->curh->cursorMove(GH.getCursorPosition().x * scalingFactor, GH.getCursorPosition().y * scalingFactor);
|
||||||
}
|
}
|
||||||
|
|
||||||
int InputSourceGameController::getMoveDis(float planDis)
|
int InputSourceGameController::getMoveDis(float planDis)
|
||||||
|
Reference in New Issue
Block a user