PEGASUS: Add support for the console back

This commit is contained in:
Matthew Hoops 2011-09-22 15:37:12 -04:00
parent dc463816af
commit ea36ec452e
3 changed files with 20 additions and 1 deletions

View File

@ -43,6 +43,7 @@ void InputDevice::getInput(Input &input, const tInputBits filter) {
// TODO: Save/Load keys
tInputBits currentBits = 0;
bool consoleRequested = false;
Common::Event event;
while (g_system->getEventManager()->pollEvent(event)) {
@ -94,6 +95,10 @@ void InputDevice::getInput(Input &input, const tInputBits filter) {
case Common::KEYCODE_DELETE:
currentBits |= (kRawButtonDown << kRightFireButtonShift);
break;
case Common::KEYCODE_d:
if (event.kbd.flags & Common::KBD_CTRL) // Console!
consoleRequested = true;
break;
default:
break;
}
@ -119,6 +124,9 @@ void InputDevice::getInput(Input &input, const tInputBits filter) {
// Update the last bits
_lastRawBits = currentBits;
// Set the console to be requested or not
input.setConsoleRequested(consoleRequested);
}
// Wait until the input device stops returning input allowed by filter...

View File

@ -353,19 +353,24 @@ public:
void getInputLocation(Common::Point &where) const { where = _inputLocation; }
bool anyInputBitSet(const tInputBits bits) const { return (_inputState & bits) != 0; }
bool isConsoleRequested() const { return _consoleRequested; }
void clearInput() {
_inputState = kAllUpBits;
_inputLocation.x = 0;
_inputLocation.y = 0;
_consoleRequested = false;
}
protected:
void setInputBits(const tInputBits state) { _inputState = state; }
void setInputLocation(const Common::Point &where) { _inputLocation = where; }
void setConsoleRequested(bool consoleRequested) { _consoleRequested = consoleRequested; }
tInputBits _inputState;
Common::Point _inputLocation;
bool _consoleRequested;
};
class InputHandler {

View File

@ -604,6 +604,12 @@ void PegasusEngine::handleInput(const Input &input, const Hotspot *cursorSpot) {
if (!checkGameMenu())
; // TODO: Other input
// Handle the console here
if (input.isConsoleRequested()) {
_console->attach();
_console->onFrame();
}
// TODO: Quit request
// TODO: Save request
// TODO: Load request