mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 13:50:13 +00:00
ULTIMA4: Shift mouse button -> interact to GameController
This commit is contained in:
parent
09b715379b
commit
bfe395bbcf
@ -42,6 +42,11 @@ bool Controller::notifyKeyPressed(int key) {
|
||||
return processed;
|
||||
}
|
||||
|
||||
bool Controller::notifyMousePress(const Common::Point &mousePos) {
|
||||
return mousePressed(mousePos);
|
||||
}
|
||||
|
||||
|
||||
int Controller::getTimerInterval() {
|
||||
return _timerInterval;
|
||||
}
|
||||
|
@ -50,6 +50,12 @@ public:
|
||||
*/
|
||||
bool notifyKeyPressed(int key);
|
||||
|
||||
/**
|
||||
* The event manager will call this method to notify that
|
||||
* the left button was clicked
|
||||
*/
|
||||
bool notifyMousePress(const Common::Point &mousePos);
|
||||
|
||||
int getTimerInterval();
|
||||
|
||||
/**
|
||||
@ -72,6 +78,13 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mouse button was pressed
|
||||
*/
|
||||
virtual bool mousePressed(const Common::Point &mousePos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles keybinder actions
|
||||
*/
|
||||
|
@ -343,11 +343,15 @@ void GameController::keybinder(KeybindingAction action) {
|
||||
MetaEngine::executeAction(action);
|
||||
}
|
||||
|
||||
bool GameController::keyPressed(int key) {
|
||||
// Manually redraw the text prompt
|
||||
g_screen->screenPrompt();
|
||||
bool GameController::mousePressed(const Common::Point &mousePos) {
|
||||
const MouseArea *area = eventHandler->mouseAreaForPoint(mousePos.x, mousePos.y);
|
||||
|
||||
return KeyHandler::defaultHandler(key, nullptr);
|
||||
if (area) {
|
||||
keybinder(KEYBIND_INTERACT);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void GameController::initMoons() {
|
||||
|
@ -122,10 +122,9 @@ public:
|
||||
void keybinder(KeybindingAction action) override;
|
||||
|
||||
/**
|
||||
* The main key handler for the game. Interpretes each key as a
|
||||
* command - 'a' for attack, 't' for talk, etc.
|
||||
* Mouse button was pressed
|
||||
*/
|
||||
bool keyPressed(int key) override;
|
||||
bool mousePressed(const Common::Point &mousePos) override;
|
||||
|
||||
/**
|
||||
* This function is called every quarter second.
|
||||
|
@ -271,10 +271,15 @@ void EventHandler::handleMouseButtonDownEvent(const Common::Event &event, Contro
|
||||
return;
|
||||
|
||||
if (event.type == Common::EVENT_LBUTTONDOWN) {
|
||||
const MouseArea *area = eventHandler->mouseAreaForPoint(event.mouse.x, event.mouse.y);
|
||||
if (!area)
|
||||
return;
|
||||
controller->keybinder(KEYBIND_INTERACT);
|
||||
// handle the keypress
|
||||
bool processed = controller->notifyMousePress(event.mouse);
|
||||
|
||||
if (processed) {
|
||||
if (updateScreen)
|
||||
(*updateScreen)();
|
||||
g_screen->update();
|
||||
}
|
||||
|
||||
} else if (event.type == Common::EVENT_RBUTTONDOWN) {
|
||||
_isRightButtonDown = true;
|
||||
handleMouseMotionEvent(event);
|
||||
|
Loading…
Reference in New Issue
Block a user