Exemplo n.º 1
0
void WidgetVerbs::render() {
	TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
	ImageFile &images = *ui._interfaceImages;

	// Create the drawing surface
	_surface.create(_bounds.width(), _bounds.height());
	_surface.fill(TRANSPARENCY);

	// Draw basic background
	makeInfoArea();

	// Draw the verb commands and the lines separating them
	for (uint idx = 0; idx < _verbCommands.size(); ++idx) {
		_surface.writeString(_verbCommands[idx], Common::Point((_bounds.width() - _surface.stringWidth(_verbCommands[idx])) / 2, 
			(_surface.fontHeight() + 7) * idx + 5), INFO_TOP);

		if (idx < (_verbCommands.size() - 1)) {
			_surface.hLine(3, (_surface.fontHeight() + 7) * (idx + 1), _bounds.width() - 4, INFO_TOP);
			_surface.hLine(3, (_surface.fontHeight() + 7) * (idx + 1) + 1, _bounds.width() - 4, INFO_MIDDLE);
			_surface.hLine(3, (_surface.fontHeight() + 7) * (idx + 1) + 2, _bounds.width() - 4, INFO_BOTTOM);

			_surface.transBlitFrom(images[4], Common::Point(0, (_surface.fontHeight() + 7) * (idx + 1) - 1));
			_surface.transBlitFrom(images[5], Common::Point(_bounds.width() - images[5]._width, 
				(_surface.fontHeight() + 7) * (idx + 1) - 1));
		}
	}
}
Exemplo n.º 2
0
void WidgetPassword::show() {
	TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
	ImageFile &images = *ui._interfaceImages;

	// Set the up window to be centered on the screen
	_bounds = Common::Rect(_surface.widestChar() * 20 + 6, (_surface.fontHeight() + 7) * 2 + 3);
	_bounds.moveTo(SHERLOCK_SCREEN_WIDTH / 2 - _bounds.width() / 2, SHERLOCK_SCREEN_HEIGHT / 2 - _bounds.height() / 2);

	// Create the surface
	_surface.create(_bounds.width(), _bounds.height());
	_surface.fill(TRANSPARENCY);
	makeInfoArea();

	// Draw the header area
	_surface.writeString(FIXED(EnterPassword), Common::Point((_bounds.width() - _surface.stringWidth(FIXED(EnterPassword))) / 2, 5), INFO_TOP);
	_surface.hLine(3, _surface.fontHeight() + 7, _bounds.width() - 4, INFO_TOP);
	_surface.hLine(3, _surface.fontHeight() + 8, _bounds.width() - 4, INFO_MIDDLE);
	_surface.hLine(3, _surface.fontHeight() + 9, _bounds.width() - 4, INFO_BOTTOM);
	_surface.transBlitFrom(images[4], Common::Point(0, _surface.fontHeight() + 7 - 1));
	_surface.transBlitFrom(images[5], Common::Point(_bounds.width() - images[5]._width, _surface.fontHeight() + 7 - 1));

	// Set the password entry data
	_cursorPos = Common::Point(_surface.widestChar(), _surface.fontHeight() + 12);
	_password = "";
	_index = 0;
	_cursorColor = 192;
	_insert = true;

	// Show the dialog
	ui._menuMode = PASSWORD_MODE;
	summonWindow();
}
Exemplo n.º 3
0
void WidgetMessage::load(const Common::String &str, int time) {
	Events &events = *_vm->_events;
	Common::Point mousePos = events.mousePos();
	_menuCounter = time;

	// Set up the bounds for the dialog to be a single line
	_bounds = Common::Rect(_surface.stringWidth(str) + _surface.widestChar() * 2 + 6, _surface.fontHeight() + 10);
	_bounds.moveTo(mousePos.x - _bounds.width() / 2, mousePos.y - _bounds.height() / 2);

	// Allocate a surface for the window
	_surface.create(_bounds.width(), _bounds.height());
	_surface.fill(TRANSPARENCY);

	// Form the background for the new window and write the line of text
	makeInfoArea();
	_surface.writeString(str, Common::Point(_surface.widestChar() + 3, 5), INFO_TOP);
}
Exemplo n.º 4
0
void WidgetText::render(const Common::String &str) {
	Common::StringArray lines;
	_remainingText = splitLines(str, lines, _bounds.width() - _surface.widestChar() * 2,
		_bounds.height() / (_surface.fontHeight() + 1));

	// Allocate a surface for the window
	_surface.create(_bounds.width(), _bounds.height());
	_surface.fill(TRANSPARENCY);

	// Form the background for the new window
	makeInfoArea();

	int yp = 5;
	for (int lineNum = 0; yp < (_bounds.height() - _surface.fontHeight() / 2); ++lineNum) {
		_surface.writeString(lines[lineNum], Common::Point(_surface.widestChar(), yp), INFO_TOP);
		yp += _surface.fontHeight() + 1;
	}
}
Exemplo n.º 5
0
void WidgetQuit::show() {
	Events &events = *_vm->_events;
	TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
	ImageFile &images = *ui._interfaceImages;
	Common::Point mousePos = events.mousePos();
	const char *YES = FIXED(Yes);
	const char *NO = FIXED(No);

	// Set up the display area
	_bounds = Common::Rect(_surface.stringWidth(FIXED(AreYouSureYou)) + _surface.widestChar() * 2,
		(_surface.fontHeight() + 7) * 4);
	_bounds.moveTo(mousePos.x - _bounds.width() / 2, mousePos.y - _bounds.height() / 2);

	// Create the surface
	_surface.create(_bounds.width(), _bounds.height());
	_surface.clear(TRANSPARENCY);
	makeInfoArea();

	// Draw the message text
	_surface.writeString(FIXED(AreYouSureYou), Common::Point((_surface.width() - _surface.stringWidth(FIXED(AreYouSureYou))) / 2, 5), INFO_TOP);
	_surface.writeString(FIXED(WishToQuit), Common::Point((_surface.width() - _surface.stringWidth(FIXED(WishToQuit))) / 2,
		_surface.fontHeight() + 9), INFO_TOP);

	// Draw the horizontal bars seperating the commands and the message
	int yp = (_surface.fontHeight() + 4) * 2 + 3;
	for (int idx = 0; idx < 2; ++idx) {
		_surface.SHtransBlitFrom(images[4], Common::Point(0, yp - 1));
		_surface.SHtransBlitFrom(images[5], Common::Point(_surface.width() - images[5]._width, yp - 1));
		_surface.hLine(3, yp, _surface.width() - 4, INFO_TOP);
		_surface.hLine(3, yp + 1, _surface.width() - 4, INFO_MIDDLE);
		_surface.hLine(3, yp + 2, _surface.width() - 4, INFO_BOTTOM);

		const char *btn = (idx == 0) ? YES : NO;
		_surface.writeString(btn, Common::Point((_bounds.width() - _surface.stringWidth(btn)) / 2, yp + 5), INFO_TOP);
		yp += _surface.fontHeight() + 7;
	}

	ui._menuMode = QUIT_MODE;
	summonWindow();
}
Exemplo n.º 6
0
void WidgetBase::makeInfoArea() {
	makeInfoArea(_surface);
}
Exemplo n.º 7
0
void WidgetFiles::render(FilesRenderMode mode) {
	TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
	ImageFile &images = *ui._interfaceImages;
	byte color;

	if (mode == RENDER_ALL) {
		_surface.clear(TRANSPARENCY);
		makeInfoArea();

		switch (_fileMode) {
		case SAVEMODE_LOAD:
			_surface.writeString(FIXED(LoadGame),
				Common::Point((_surface.width() - _surface.stringWidth(FIXED(LoadGame))) / 2, 5), INFO_TOP);
			break;

		case SAVEMODE_SAVE:
			_surface.writeString(FIXED(SaveGame),
				Common::Point((_surface.width() - _surface.stringWidth(FIXED(SaveGame))) / 2, 5), INFO_TOP);
			break;

		default:
			break;
		}

		_surface.hLine(3, _surface.fontHeight() + 7, _surface.width() - 4, INFO_TOP);
		_surface.hLine(3, _surface.fontHeight() + 8, _surface.width() - 4, INFO_MIDDLE);
		_surface.hLine(3, _surface.fontHeight() + 9, _surface.width() - 4, INFO_BOTTOM);
		_surface.SHtransBlitFrom(images[4], Common::Point(0, _surface.fontHeight() + 6));
		_surface.SHtransBlitFrom(images[5], Common::Point(_surface.width() - images[5]._width, _surface.fontHeight() + 6));

		int xp = _surface.width() - BUTTON_SIZE - 6;
		_surface.vLine(xp, _surface.fontHeight() + 10, _bounds.height() - 4, INFO_TOP);
		_surface.vLine(xp + 1, _surface.fontHeight() + 10, _bounds.height() - 4, INFO_MIDDLE);
		_surface.vLine(xp + 2, _surface.fontHeight() + 10, _bounds.height() - 4, INFO_BOTTOM);
		_surface.SHtransBlitFrom(images[6], Common::Point(xp - 1, _surface.fontHeight() + 8));
		_surface.SHtransBlitFrom(images[7], Common::Point(xp - 1, _bounds.height() - 4));
	}

	int xp = _surface.stringWidth("00.") + _surface.widestChar() + 5;
	int yp = _surface.fontHeight() + 14;

	for (int idx = _savegameIndex; idx < (_savegameIndex + FILES_LINES_COUNT); ++idx) {
		if (idx == _selector && mode != RENDER_ALL)
			color = COMMAND_HIGHLIGHTED;
		else
			color = INFO_TOP;

		if (mode == RENDER_NAMES_AND_SCROLLBAR)
			_surface.fillRect(Common::Rect(4, yp, _surface.width() - BUTTON_SIZE - 9, yp + _surface.fontHeight()), TRANSPARENCY);

		Common::String numStr = Common::String::format("%d.", idx + 1);
		_surface.writeString(numStr, Common::Point(_surface.widestChar(), yp), color);
		_surface.writeString(_savegames[idx], Common::Point(xp, yp), color);

		yp += _surface.fontHeight() + 1;
	}

	// Draw the Scrollbar if neccessary
	if (mode != RENDER_NAMES)
		drawScrollBar(_savegameIndex, FILES_LINES_COUNT, _savegames.size());
}
Exemplo n.º 8
0
void WidgetOptions::render(OptionRenderMode mode) {
	TattooEngine &vm = *(TattooEngine *)_vm;
	Music &music = *_vm->_music;
	Sound &sound = *_vm->_sound;
	TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
	ImageFile &images = *ui._interfaceImages;
	const char *const OFF_ON[2] = { FIXED(Off), FIXED(On) };

	// Draw the border if necessary
	if (mode == OP_ALL) {
		// Set bounds for the dialog
		Common::String widestString = Common::String::format("%s %s", FIXED(TransparentMenus), FIXED(Off));
		_bounds = Common::Rect(_surface.stringWidth(widestString) + _surface.widestChar() * 2 + 6,
			(_surface.fontHeight() + 7) * 11 + 3);
		_bounds.moveTo(_centerPos.x - _bounds.width() / 2, _centerPos.y - _bounds.height() / 2);

		// Get slider positions
		_midiSliderX = music._musicVolume * (_bounds.width() - _surface.widestChar() * 2) / 255 + _surface.widestChar();
		_digiSliderX = sound._soundVolume * (_bounds.width() - _surface.widestChar() * 2) / 255 + _surface.widestChar();

		// Setup the dialog
		_surface.create(_bounds.width(), _bounds.height());
		_surface.fill(TRANSPARENCY);
		makeInfoArea();

		// Draw the lines separating options in the dialog
		int yp = _surface.fontHeight() + 7;
		for (int idx = 0; idx < 7; ++idx) {
			_surface.transBlitFrom(images[4], Common::Point(0, yp - 1));
			_surface.transBlitFrom(images[5], Common::Point(_surface.w() - images[5]._width, yp - 1));
			_surface.hLine(3, yp, _surface.w() - 4, INFO_TOP);
			_surface.hLine(3, yp + 1, _surface.w() - 4, INFO_MIDDLE);
			_surface.hLine(3, yp + 2, _surface.w() - 4, INFO_BOTTOM);

			yp += _surface.fontHeight() + 7;
			if (idx == 1)
				yp += _surface.fontHeight() + 7;
			else if (idx == 2)
				yp += (_surface.fontHeight() + 7) * 2;
		}
	}

	// Now go through and display all the items that can be highlighted
	for (int idx = 0, yp = 5; idx < 11; ++idx, yp += _surface.fontHeight() + 7) {
		if (mode == OP_ALL || idx == _selector || idx == _oldSelector) {
			if (mode == OP_NAMES)
				_surface.fillRect(Common::Rect(4, yp, _surface.w() - 5, yp + _surface.fontHeight() - 1), TRANSPARENCY);
			byte color = (idx == _selector) ? COMMAND_HIGHLIGHTED : INFO_TOP;
			Common::String str;

			switch (idx) {
			case 0:
				str = FIXED(LoadGame);
				break;

			case 1:
				str = FIXED(SaveGame);
				break;

			case 2:
				str = Common::String::format("%s %s", FIXED(Music), OFF_ON[music._musicOn]);
				break;

			case 3: {
				int num = (_surface.fontHeight() + 4) & 0xfe;
				int sliderY = yp + num / 2 - 8;

				_surface.fillRect(Common::Rect(4, sliderY - (num - 6) / 2, _surface.w() - 5, 
					sliderY - (num - 6) / 2 + num - 1), TRANSPARENCY);
				_surface.fillRect(Common::Rect(_surface.widestChar(), sliderY + 2, 
					_surface.w() - _surface.widestChar() - 1, sliderY + 3), INFO_MIDDLE);
				drawDialogRect(Common::Rect(_surface.widestChar(), sliderY, _surface.w() - _surface.widestChar(), sliderY + 6));
				
				_surface.fillRect(Common::Rect(_midiSliderX - 1, sliderY - (num - 6) / 2 + 2, 
					_midiSliderX + 1, sliderY - (num - 6) / 2 + num - 3), INFO_MIDDLE);
				drawDialogRect(Common::Rect(_midiSliderX - 3, sliderY - (num - 6) / 2, 
					_midiSliderX + 4, sliderY - (num - 6) / 2 + num));
	
				if (_midiSliderX - 4 > _surface.widestChar())
					_surface.fillRect(Common::Rect(_midiSliderX - 4, sliderY, _midiSliderX - 4, sliderY + 4), INFO_BOTTOM);
				if (_midiSliderX + 4 < _surface.w() - _surface.widestChar())
					_surface.fillRect(Common::Rect(_midiSliderX + 4, sliderY, _midiSliderX + 4, sliderY + 4), INFO_BOTTOM);
				break;
			}

			case 4:
				str = Common::String::format("%s %s", FIXED(SoundEffects), OFF_ON[sound._digitized]);
				break;

			case 5:
				str = Common::String::format("%s %s", FIXED(Voices), OFF_ON[sound._voices]);
				break;

			case 6: {
				int num = (_surface.fontHeight() + 4) & 0xfe;
				int sliderY = yp + num / 2 - 8;

				_surface.fillRect(Common::Rect(4, sliderY - (num - 6) / 2, _surface.w() - 5, 
					sliderY - (num - 6) / 2 + num - 1), TRANSPARENCY);
				_surface.fillRect(Common::Rect(_surface.widestChar(), sliderY + 2, _surface.w() - _surface.widestChar() - 1, 
					sliderY + 3), INFO_MIDDLE);
				drawDialogRect(Common::Rect(_surface.widestChar(), sliderY, _surface.w() - _surface.widestChar(), sliderY + 6));
				_surface.fillRect(Common::Rect(_digiSliderX - 1, sliderY - (num - 6) / 2 + 2, _digiSliderX + 1, 
					sliderY - (num - 6) / 2 + num - 3), INFO_MIDDLE);
				drawDialogRect(Common::Rect(_digiSliderX - 3, sliderY - (num - 6) / 2, _digiSliderX + 4, 
					sliderY - (num - 6) / 2 + num));
				if (_digiSliderX - 4 > _surface.widestChar())
					_surface.fillRect(Common::Rect(_digiSliderX - 4, sliderY, _digiSliderX - 4, sliderY + 4), INFO_BOTTOM);
				if (_digiSliderX + 4 < _surface.w() - _surface.widestChar())
					_surface.fillRect(Common::Rect(_digiSliderX + 4, sliderY, _digiSliderX + 4, sliderY + 4), INFO_BOTTOM);
				break;
			}

			case 7:
				if (!sound._voices) {
					color = INFO_BOTTOM;
					str = Common::String::format("%s %s", FIXED(TextWindows), FIXED(On));
				} else {
					str = Common::String::format("%s %s", FIXED(TextWindows), OFF_ON[vm._textWindowsOn]);
				}
				break;

			case 8:
				str = FIXED(ChangeFont);
				break;

			case 9:
				str = Common::String::format("%s %s", FIXED(TransparentMenus), OFF_ON[vm._transparentMenus]);
				break;

			case 10:
				str = FIXED(Quit);
				break;

			default:
				break;
			}

			// Unless we're doing one of the Slider Controls, print the text for the line
			if (idx != 3 && idx != 6) {
				int xp = (_surface.w() - _surface.stringWidth(str)) / 2;
				_surface.writeString(str, Common::Point(xp, yp), color);
			}
		}
	}
}