Esempio n. 1
0
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);
			}
		}
	}
}