mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-23 04:33:09 +00:00
FREESCAPE: refactored on screen controller code to acept clicks outside the view area
This commit is contained in:
parent
3be5373018
commit
397a73572c
@ -501,10 +501,17 @@ void FreescapeEngine::processInput() {
|
||||
case Common::EVENT_LBUTTONDOWN:
|
||||
if (_hasFallen)
|
||||
break;
|
||||
if (_viewArea.contains(_crossairPosition))
|
||||
shoot();
|
||||
else
|
||||
onScreenControls(_crossairPosition);
|
||||
mousePos = event.mouse;
|
||||
{
|
||||
bool touchedScreenControls = false;
|
||||
|
||||
#if defined(__ANDROID__) || defined(IPHONE)
|
||||
touchedScreenControls = onScreenControls(mousePos);
|
||||
#endif
|
||||
|
||||
if (!touchedScreenControls && _viewArea.contains(_crossairPosition))
|
||||
shoot();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -513,7 +520,8 @@ void FreescapeEngine::processInput() {
|
||||
}
|
||||
}
|
||||
|
||||
void FreescapeEngine::onScreenControls(Common::Point mouse) {
|
||||
bool FreescapeEngine::onScreenControls(Common::Point mouse) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void FreescapeEngine::executeMovementConditions() {
|
||||
|
@ -221,7 +221,7 @@ public:
|
||||
void resetInput();
|
||||
void generateDemoInput();
|
||||
virtual void pressedKey(const int keycode);
|
||||
virtual void onScreenControls(Common::Point mouse);
|
||||
virtual bool onScreenControls(Common::Point mouse);
|
||||
void move(CameraMovement direction, uint8 scale, float deltaTime);
|
||||
virtual void checkIfStillInArea();
|
||||
void changePlayerHeight(int index);
|
||||
@ -485,7 +485,7 @@ private:
|
||||
void drawCPCUI(Graphics::Surface *surface) override;
|
||||
void drawC64UI(Graphics::Surface *surface) override;
|
||||
void drawAmigaAtariSTUI(Graphics::Surface *surface) override;
|
||||
void onScreenControls(Common::Point mouse) override;
|
||||
bool onScreenControls(Common::Point mouse) override;
|
||||
void initAmigaAtari();
|
||||
void initDOS();
|
||||
void initZX();
|
||||
|
@ -819,32 +819,43 @@ bool DrillerEngine::checkIfGameEnded() {
|
||||
return false;
|
||||
}
|
||||
|
||||
void DrillerEngine::onScreenControls(Common::Point mouse) {
|
||||
if (_moveFowardArea.contains(mouse))
|
||||
bool DrillerEngine::onScreenControls(Common::Point mouse) {
|
||||
if (_moveFowardArea.contains(mouse)) {
|
||||
move(kForwardMovement, _scaleVector.x(), 20.0);
|
||||
else if (_moveLeftArea.contains(mouse))
|
||||
return true;
|
||||
} else if (_moveLeftArea.contains(mouse)) {
|
||||
move(kLeftMovement, _scaleVector.y(), 20.0);
|
||||
else if (_moveRightArea.contains(mouse))
|
||||
return true;
|
||||
} else if (_moveRightArea.contains(mouse)) {
|
||||
move(kRightMovement, _scaleVector.y(), 20.0);
|
||||
else if (_moveBackArea.contains(mouse))
|
||||
return true;
|
||||
} else if (_moveBackArea.contains(mouse)) {
|
||||
move(kBackwardMovement, _scaleVector.x(), 20.0);
|
||||
else if (_moveUpArea.contains(mouse))
|
||||
return true;
|
||||
} else if (_moveUpArea.contains(mouse)) {
|
||||
rise();
|
||||
else if (_moveDownArea.contains(mouse))
|
||||
return true;
|
||||
} else if (_moveDownArea.contains(mouse)) {
|
||||
lower();
|
||||
else if (_deployDrillArea.contains(mouse))
|
||||
return true;
|
||||
} else if (_deployDrillArea.contains(mouse)) {
|
||||
pressedKey(Common::KEYCODE_d);
|
||||
else if (_infoScreenArea.contains(mouse))
|
||||
return true;
|
||||
} else if (_infoScreenArea.contains(mouse)) {
|
||||
drawInfoMenu();
|
||||
else if (_saveGameArea.contains(mouse)) {
|
||||
return true;
|
||||
} else if (_saveGameArea.contains(mouse)) {
|
||||
_gfx->setViewport(_fullscreenViewArea);
|
||||
saveGameDialog();
|
||||
_gfx->setViewport(_viewArea);
|
||||
return true;
|
||||
} else if (_loadGameArea.contains(mouse)) {
|
||||
_gfx->setViewport(_fullscreenViewArea);
|
||||
loadGameDialog();
|
||||
_gfx->setViewport(_viewArea);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user