void SelectionMenu::drawMenu(FWRenderer &r, bool top) { const int height = getElementCount() * 9 + 10; int x = _pos.x; int y = _pos.y; if (x + _width > 319) x = 319 - _width; if (y + height > 199) y = 199 - height; const bool isAmiga = (g_cine->getPlatform() == Common::kPlatformAmiga); if (isAmiga) { r.drawTransparentBox(x, y, _width, height); r.drawDoubleBorder(x, y, _width, height, 18); } else { r.drawPlainBox(x, y, _width, height, r._messageBg); r.drawDoubleBorder(x, y, _width, height, 2); } int lineY = y + 4; const int elemCount = getElementCount(); for (int i = 0; i < elemCount; ++i, lineY += 9) { int charX = x + 4; if (i == _selection) { int color; if (isAmiga) { if (top) { color = 2; } else { color = 18; } } else { color = 0; } r.drawPlainBox(x + 2, lineY - 1, _width - 3, 9, color); } const int size = _elements[i].size(); for (int j = 0; j < size; ++j) { if (isAmiga && i == _selection) { charX = r.undrawChar(_elements[i][j], charX, lineY); } else { charX = r.drawChar(_elements[i][j], charX, lineY); } } } }
void SelectionMenu::drawMenu(FWRenderer &r, bool top) { const int height = getElementCount() * 9 + 10; int x = _pos.x; int y = _pos.y; if (x + _width > 319) x = 319 - _width; if (y + height > 199) y = 199 - height; const bool isAmiga = (g_cine->getPlatform() == Common::kPlatformAmiga); if (isAmiga) { r.drawTransparentBox(x, y, _width, height); r.drawDoubleBorder(x, y, _width, height, 18); } else { r.drawPlainBox(x, y, _width, height, r._messageBg); r.drawDoubleBorder(x, y, _width, height, 2); } int lineY = y + 4; int charX; const int elemCount = getElementCount(); for (int i = 0; i < elemCount; ++i, lineY += 9) { charX = x + 4; if (i == _selection) { if (isAmiga) { // The original Amiga version is using a different highlight color here, // but with our current code it is not possible to change the text color, // thus we can not use the Amiga's color, since otherwise the text // wouldn't be visible anymore. r.drawPlainBox(charX, lineY, _width - 8, FONT_HEIGHT, top ? r._messageBg/*2*/ : 18); } else { r.drawPlainBox(charX, lineY, _width - 8, 9, 0); } } const int size = _elements[i].size(); for (int j = 0; j < size; ++j) charX = r.drawChar(_elements[i][j], charX, lineY); } }
void TextInputMenu::drawMenu(FWRenderer &r, bool top) { const int x = _pos.x; const int y = _pos.y; int i, tx, ty, tw; int line = 0, words = 0, cw = 0; int space = 0, extraSpace = 0; const bool isAmiga = (g_cine->getPlatform() == Common::kPlatformAmiga); if (isAmiga) r.drawTransparentBox(x, y, _width, 4); else r.drawPlainBox(x, y, _width, 4, r._messageBg); tx = x + 4; ty = _info[0] ? y - 5 : y + 4; tw = _width - 8; const int infoSize = _info.size(); // input box info message for (i = 0; i < infoSize; i++, line--) { // fit line of text if (!line) { line = fitLine(_info.c_str() + i, tw, words, cw); if (i + line < infoSize && words) { space = (tw - cw) / words; extraSpace = (tw - cw) % words; } else { space = 5; extraSpace = 0; } ty += 9; if (isAmiga) r.drawTransparentBox(x, ty, _width, 9); else r.drawPlainBox(x, ty, _width, 9, r._messageBg); tx = x + 4; } // draw characters if (_info[i] == ' ') { tx += space + extraSpace; if (extraSpace) { extraSpace = 0; } } else { tx = r.drawChar(_info[i], tx, ty); } } // input area background ty += 9; if (isAmiga) r.drawTransparentBox(x, ty, _width, 9); else r.drawPlainBox(x, ty, _width, 9, r._messageBg); r.drawPlainBox(x + 16, ty - 1, _width - 32, 9, 0); tx = x + 20; // text in input area const int inputSize = _input.size(); for (i = 0; i < inputSize; i++) { tx = r.drawChar(_input[i], tx, ty); if (_cursor == i + 2) { r.drawLine(tx, ty - 1, 1, 9, 2); } } if (_input.empty() || _cursor == 1) { r.drawLine(x + 20, ty - 1, 1, 9, 2); } ty += 9; if (isAmiga) r.drawTransparentBox(x, ty, _width, 4); else r.drawPlainBox(x, ty, _width, 4, r._messageBg); r.drawDoubleBorder(x, y, _width, ty - y + 4, isAmiga ? 18 : 2); }