예제 #1
0
void RightClickDialog::draw() {
	// Save the covered background area
	_savedArea = surfaceGetArea(g_globals->_gfxManagerInstance.getSurface(), _bounds);

	// Draw the dialog image
	g_globals->gfxManager().copyFrom(_surface, _bounds.left, _bounds.top);
}
예제 #2
0
void SceneArea::display() {
	_bounds.left = _pt.x - (_surface.getBounds().width() / 2);
	_bounds.top = _pt.y + 1 - _surface.getBounds().height();
	_bounds.setWidth(_surface.getBounds().width());
	_bounds.setHeight(_surface.getBounds().height());

	_savedArea = surfaceGetArea(g_globals->_gfxManagerInstance.getSurface(), _bounds);
	draw2();
}
예제 #3
0
void AmmoBeltDialog::draw() {
	Rect bounds = _bounds;

	if (!_savedArea) {
		// Save the covered background area
		_savedArea = surfaceGetArea(g_globals->_gfxManagerInstance.getSurface(), _bounds);
	} else {
		bounds.moveTo(0, 0);
	}

	// Draw the dialog image
	g_globals->gfxManager().copyFrom(_surface, bounds.left, bounds.top);

	// Setup clip flags
	bool clip1 = true, clip2 = true;
	bool gunLoaded = BF_GLOBALS.getFlag(fGunLoaded);
	if (gunLoaded) {
		// A clip is currently loaded. Hide the appropriate clip
		if (BF_GLOBALS.getFlag(fLoadedSpare))
			clip2 = false;
		else
			clip1 = false;
	}

	// Draw the first clip if necessary
	if (clip1) {
		GfxSurface clipSurface = surfaceFromRes(9, 6, BF_GLOBALS._clip1Bullets + 1);
		_clip1Rect.resize(clipSurface, _clip1Rect.left, _clip1Rect.top, 100);
		g_globals->gfxManager().copyFrom(clipSurface, bounds.left + _clip1Rect.left,
			bounds.top + _clip1Rect.top);
	}

	// Draw the second clip if necessary
	if (clip2) {
		GfxSurface clipSurface = surfaceFromRes(9, 6, BF_GLOBALS._clip2Bullets + 1);
		_clip2Rect.resize(clipSurface, _clip2Rect.left, _clip2Rect.top, 100);
		g_globals->gfxManager().copyFrom(clipSurface, bounds.left + _clip2Rect.left,
			bounds.top + _clip2Rect.top);
	}

	// If a clip is loaded, draw the 'loaded' portion of the gun
	if (gunLoaded) {
		GfxSurface loadedSurface = surfaceFromRes(9, 7, 1);
		_loadedRect.resize(loadedSurface, _loadedRect.left, _loadedRect.top, 100);
		g_globals->gfxManager().copyFrom(loadedSurface, bounds.left + _loadedRect.left,
			bounds.top + _loadedRect.top);
	}
}
예제 #4
0
void RightClickDialog::draw() {
	// Save the covered background area
	_savedArea = surfaceGetArea(g_globals->_gfxManagerInstance.getSurface(), _bounds);

	// Draw the dialog image
	g_globals->gfxManager().copyFrom(_surface, _bounds.left, _bounds.top);

	// Pre-process rect lists
	for (int idx = 0; idx < 5; ++idx) {
		_rectList2[idx] = _rectList1[idx];
		_rectList4[idx] = _rectList3[idx];

		_rectList2[idx].translate(_bounds.left, _bounds.top);
		_rectList4[idx].translate(_bounds.left, _bounds.top);
	}
}
예제 #5
0
void UIQuestion::showItem(int resNum, int rlbNum, int frameNum) {
	GfxDialog::setPalette();

	// Get the item to display
	GfxSurface objImage = surfaceFromRes(resNum, rlbNum, frameNum);
	Rect imgRect;
	imgRect.resize(objImage, 0, 0, 100);
	imgRect.center(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2);

	// Save the area behind where the image will be displayed
	GfxSurface *savedArea = surfaceGetArea(GLOBALS.gfxManager().getSurface(), imgRect);

	// Draw the image
	GLOBALS.gfxManager().copyFrom(objImage, imgRect);

	// Wait for a press
	GLOBALS._events.waitForPress();

	// Restore the old area
	GLOBALS.gfxManager().copyFrom(*savedArea, imgRect);
	delete savedArea;
}
예제 #6
0
void ModalDialog::draw() {
	// Set the palette for use in the dialog
	setPalette();

	// Make a backup copy of the area the dialog will occupy
	Rect tempRect = _bounds;
	tempRect.collapse(-10, -10);
	_savedArea = surfaceGetArea(g_globals->_gfxManagerInstance.getSurface(), tempRect);

	_gfxManager.activate();

	// Fill in the contents of the entire dialog
	_gfxManager._bounds = Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
	drawFrame();

	// Draw each element in the dialog in order
	GfxElementList::iterator i;
	for (i = _elements.begin(); i != _elements.end(); ++i) {
		(*i)->draw();
	}

	_gfxManager.deactivate();
}