AGI: Message box mouse support

This commit is contained in:
Martin Kiewitz 2016-02-03 08:27:44 +01:00
parent d23871fdd8
commit a9bb8c3a50
2 changed files with 21 additions and 0 deletions

View File

@ -340,13 +340,16 @@ bool AgiEngine::handleMouseClicks(uint16 &key) {
case CYCLE_INNERLOOP_INVENTORY:
// TODO: forward
break;
case CYCLE_INNERLOOP_MENU_VIA_KEYBOARD:
_menu->mouseEvent(key);
key = 0; // eat event
break;
case CYCLE_INNERLOOP_SYSTEMUI_SELECTSAVEDGAMESLOT:
// TODO: forward
break;
default:
break;
}

View File

@ -392,6 +392,24 @@ void TextMgr::messageBox_KeyPress(uint16 newKey) {
_messageBoxCancelled = true;
_vm->cycleInnerLoopInactive(); // exit messagebox-loop
break;
case AGI_MOUSE_BUTTON_LEFT: {
// Find out, where current mouse cursor actually is
int16 mouseY = _vm->_mouse.pos.y;
int16 mouseX = _vm->_mouse.pos.x;
_vm->adjustPosToGameScreen(mouseX, mouseY);
// Check, if mouse cursor is within message box
// If it is, take the click as ENTER.
// That's what AGI on Amiga + Apple IIgs did.
// On Atari ST at least via emulator it seems that the mouse cursor froze when messageboxes were diplayed.
if ((mouseX >= _messageState.backgroundPos_x) && (mouseX <= (_messageState.backgroundPos_x + _messageState.backgroundSize_Width))) {
if ((mouseY >= _messageState.backgroundPos_y - _messageState.backgroundSize_Height) && (mouseY <= (_messageState.backgroundPos_y))) {
_vm->cycleInnerLoopInactive(); // exit messagebox-loop
}
}
break;
}
default:
break;
}