LAB: Simulate events by setting an unused key

This commit is contained in:
Filippos Karapetis 2015-12-28 01:58:17 +02:00
parent c9bda09bc0
commit f6e42a7282
4 changed files with 11 additions and 4 deletions

View file

@ -53,7 +53,8 @@ bool Console::Cmd_Scene(int argc, const char **argv) {
_vm->_closeDataPtr = nullptr;
_vm->_mainDisplay = true;
_vm->_followingCrumbs = false;
_vm->_event->simulateLeftClick();
_vm->_event->simulateEvent();
_vm->_graphics->_longWinInFront = false;
return false;
}

View file

@ -205,4 +205,9 @@ Common::Point EventManager::updateAndGetMousePos() {
return _mousePos;
}
void EventManager::simulateEvent() {
// Simulate an event by setting an unused key
_keyPressed = Common::KeyState(Common::KEYCODE_SEMICOLON);
}
} // End of namespace Lab

View file

@ -123,10 +123,10 @@ public:
Common::Point updateAndGetMousePos();
/**
* Simulates a left click for the game main loop, when a game is
* Simulates an event for the game main loop, when a game is
* loaded or when the user teleports to a scene
*/
void simulateLeftClick() { _leftClick = true; }
void simulateEvent();
};
} // End of namespace Lab

View file

@ -249,7 +249,8 @@ Common::Error LabEngine::loadGameState(int slot) {
_closeDataPtr = nullptr;
_mainDisplay = true;
_followingCrumbs = false;
_event->simulateLeftClick();
_event->simulateEvent();
_graphics->_longWinInFront = false;
return (result) ? Common::kNoError : Common::kUserCanceled;
}