Exemple #1
0
void UIElements::setup(const Common::Point &pt) {
	_slotStart = 0;
	_itemList.clear();
	_scoreValue = 0;
	_active = true;
	UICollection::setup(pt);
	hide();

	_object1.setup(1, 3, 1, 0, 0, 255);
	add(&_object1);

	// Set up the inventory slots
	int xp = 0;
	for (int idx = 0; idx < 4; ++idx) {
		UIElement *item = NULL;
		switch (idx) {
		case 0:
			item = &_slot1;
			break;
		case 1:
			item = &_slot2;
			break;
		case 2:
			item = &_slot3;
			break;
		case 3:
			item = &_slot4;
			break;
		}

		xp = idx * 63 + 2;
		item->setup(9, 1, idx, xp, 4, 255);
		add(item);
	}

	// Setup bottom-right hand buttons
	xp += 62;
	_question.setup(1, 4, 7, xp, 16, 255);
	_question.setEnabled(false);
	add(&_question);

	xp += 21;
	_scrollLeft.setup(1, 4, 1, xp, 16, 255);
	add(&_scrollLeft);
	_scrollLeft._isLeft = true;

	xp += 22;
	_scrollRight.setup(1, 4, 4, xp, 16, 255);
	add(&_scrollRight);
	_scrollRight._isLeft = false;

	// Set up the score
	_score.postInit();
	add(&_score);

	// Set interface area
	_bounds = Rect(0, BF_INTERFACE_Y - 1, SCREEN_WIDTH, SCREEN_HEIGHT);

	updateInventory();
}
Exemple #2
0
void UIElements::setup(const Common::Point &pt) {
	_slotStart = 0;
	_itemList.clear();
	_scoreValue = 0;
	_active = true;
	UICollection::setup(pt);
	hide();

	_background.setup(1, 3, 1, 0, 0, 255);
	add(&_background);

	// Set up the inventory slots
	int xp = 0;
	for (int idx = 0; idx < 4; ++idx) {
		UIElement *item = NULL;
		switch (idx) {
		case 0:
			item = &_slot1;
			break;
		case 1:
			item = &_slot2;
			break;
		case 2:
			item = &_slot3;
			break;
		case 3:
			item = &_slot4;
			break;
		}

		xp = idx * 63 + 2;
		if (g_vm->getGameID() == GType_BlueForce) {
			item->setup(9, 1, idx, xp, 4, 255);
		} else {
			item->setup(7, 1, idx, xp, 4, 255);
		}
		add(item);
	}

	// Setup bottom-right hand buttons
	xp = (g_vm->getGameID() == GType_Ringworld2) ? 255 : 253;
	int yp = (g_vm->getGameID() == GType_BlueForce) ? 16 : 17;
	_question.setup(1, 4, 7, xp, yp, 255);
	_question.setEnabled(false);
	add(&_question);

	xp += 21;
	_scrollLeft.setup(1, 4, 1, xp, yp, 255);
	add(&_scrollLeft);
	_scrollLeft._isLeft = true;

	xp += (g_vm->getGameID() == GType_Ringworld2) ? 21 : 22;
	_scrollRight.setup(1, 4, 4, xp, yp, 255);
	add(&_scrollRight);
	_scrollRight._isLeft = false;

	switch (g_vm->getGameID()) {
	case GType_BlueForce:
		// Set up the score
		_score.postInit();
		add(&_score);
		break;
	case GType_Ringworld2:
		// Set up the character display
		_character.setup(1, 5, R2_GLOBALS._player._characterIndex, 285, 11, 255);
		add(&_character);
		break;
	default:
		break;
	}

	// Set interface area
	_bounds = Rect(0, UI_INTERFACE_Y - 1, SCREEN_WIDTH, SCREEN_HEIGHT);

	updateInventory();
}