• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ TooltipData类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中TooltipData的典型用法代码示例。如果您正苦于以下问题:C++ TooltipData类的具体用法?C++ TooltipData怎么用?C++ TooltipData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了TooltipData类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: checkTooltip

/**
 * Show mouseover descriptions of disciplines and powers
 */
TooltipData MenuPowers::checkTooltip(const Point& mouse) {

	TooltipData tip;

	for (size_t i=0; i<power_cell.size(); i++) {

		if (tab_control && (tab_control->getActiveTab() != power_cell[i].tab)) continue;

		int cell_index = getCellByPowerIndex(power_cell[i].id, power_cell_all);
		if (!checkCellVisible(cell_index)) continue;

		if (slots[i] && isWithinRect(slots[i]->pos, mouse)) {
			bool base_unlocked = checkUnlocked(cell_index) || std::find(stats->powers_list.begin(), stats->powers_list.end(), power_cell[i].id) != stats->powers_list.end();

			createTooltip(&tip, static_cast<int>(i), power_cell, !base_unlocked);
			if (!power_cell[i].upgrades.empty()) {
				int next_level = getNextLevelCell(static_cast<int>(i));
				if (next_level != -1) {
					tip.addText("\n" + msg->get("Next Level:"));
					createTooltip(&tip, next_level, power_cell_upgrade, base_unlocked);
				}
			}

			return tip;
		}
	}

	return tip;
}
开发者ID:sudoman,项目名称:flare-engine,代码行数:32,代码来源:MenuPowers.cpp


示例2: checkTooltip

/**
 * Show mouseover descriptions of disciplines and powers
 */
TooltipData MenuPowers::checkTooltip(Point mouse) {

	TooltipData tip;

	for (unsigned i=0; i<power_cell.size(); i++) {

		if ((tabs_count > 1) && (tabControl->getActiveTab() != power_cell[i].tab)) continue;

		if (!powerIsVisible(power_cell[i].id)) continue;

		if (isWithin(slots[i]->pos, mouse)) {
			generatePowerDescription(&tip, i);

			if (power_cell[i].next_level != 0) {
				tip.addText(msg->get("\nNext Level:"));
				short next_level_cell = id_by_powerIndex(power_cell[i].next_level);
				generatePowerDescription(&tip, next_level_cell);
			}

			return tip;
		}
	}

	return tip;
}
开发者ID:mikhailSaTuRn,项目名称:flare-engine,代码行数:28,代码来源:MenuPowers.cpp


示例3: checkTooltip

/**
 * If mousing-over an item with a tooltip, return that tooltip data.
 *
 * @param mouse The x,y screen coordinates of the mouse cursor
 */
TooltipData MenuInventory::checkTooltip(Point position) {
	int area;
	int slot;
	TooltipData tip;

	area = areaOver(position);
	if (area == -1) {
		if (position.x >= window_area.x + help_pos.x && position.y >= window_area.y+help_pos.y && position.x < window_area.x+help_pos.x+help_pos.w && position.y < window_area.y+help_pos.y+help_pos.h) {
			tip.addText(msg->get("Use SHIFT to move only one item."));
			tip.addText(msg->get("CTRL-click a carried item to sell it."));
		}
		return tip;
	}
	slot = inventory[area].slotOver(position);

	if (slot == -1)
		return tip;

	if (inventory[area][slot].item > 0) {
		tip = inventory[area].checkTooltip(position, stats, PLAYER_INV);
	}
	else if (area == EQUIPMENT && inventory[area][slot].item == 0) {
		tip.addText(msg->get(slot_desc[slot]));
	}

	return tip;
}
开发者ID:RyanDansie,项目名称:flare-engine,代码行数:32,代码来源:MenuInventory.cpp


示例4: checkTooltip

/**
 * Show mouseover descriptions of disciplines and powers
 */
TooltipData MenuPowers::checkTooltip(Point mouse) {

	TooltipData tip;

	for (unsigned i=0; i<power_cell.size(); i++) {

		if ((tabs_count > 1) && (tabControl->getActiveTab() != power_cell[i].tab)) continue;

		if (!powerIsVisible(power_cell[i].id)) continue;

		if (isWithin(slots[i]->pos, mouse)) {
			generatePowerDescription(&tip, i, power_cell);
			if (!power_cell[i].upgrades.empty()) {
				short next_level = nextLevel(i);
				if (next_level != -1) {
					tip.addText("\n" + msg->get("Next Level:"));
					generatePowerDescription(&tip, next_level, power_cell_upgrade);
				}
			}

			return tip;
		}
	}

	return tip;
}
开发者ID:YuanhuanZheng,项目名称:flare-engine,代码行数:29,代码来源:MenuPowers.cpp


示例5: getShortTooltip

TooltipData ItemManager::getShortTooltip(ItemStack stack) {
	stringstream ss;
	TooltipData tip;
	SDL_Color color = color_normal;

	if (stack.item == 0) return tip;

	// color quality
	if (items[stack.item].set > 0) {
		color = item_sets[items[stack.item].set].color;
	}
	else if (items[stack.item].quality == ITEM_QUALITY_LOW) {
		color = color_low;
	}
	else if (items[stack.item].quality == ITEM_QUALITY_HIGH) {
		color = color_high;
	}
	else if (items[stack.item].quality == ITEM_QUALITY_EPIC) {
		color = color_epic;
	}

	// name
	if (stack.quantity > 1) {
		ss << stack.quantity << " " << items[stack.item].name;
	} else {
		ss << items[stack.item].name;
	}
	tip.addText(ss.str(), color);

	return tip;
}
开发者ID:Bonbadil,项目名称:flare-engine,代码行数:31,代码来源:ItemManager.cpp


示例6: checkTooltip

/**
 * Show mouseover descriptions of disciplines and powers
 */
TooltipData MenuPowers::checkTooltip(Point mouse) {

	TooltipData tip;

	for (unsigned i=0; i<power_cell.size(); i++) {

		if (tab_control && (tab_control->getActiveTab() != power_cell[i].tab)) continue;

		if (!powerIsVisible(power_cell[i].id)) continue;

		if (slots[i] && isWithin(slots[i]->pos, mouse)) {
			bool base_unlocked = requirementsMet(power_cell[i].id) || std::find(stats->powers_list.begin(), stats->powers_list.end(), power_cell[i].id) != stats->powers_list.end();

			generatePowerDescription(&tip, i, power_cell, !base_unlocked);
			if (!power_cell[i].upgrades.empty()) {
				short next_level = nextLevel(static_cast<short>(i));
				if (next_level != -1) {
					tip.addText("\n" + msg->get("Next Level:"));
					generatePowerDescription(&tip, next_level, power_cell_upgrade, base_unlocked);
				}
			}

			return tip;
		}
	}

	return tip;
}
开发者ID:Jeffry84,项目名称:flare-engine,代码行数:31,代码来源:MenuPowers.cpp


示例7: checkTooltip

/**
 * If mousing-over an item with a tooltip, return that tooltip data.
 *
 * @param mouse The x,y screen coordinates of the mouse cursor
 */
TooltipData MenuInventory::checkTooltip(const Point& position) {
	int area;
	int slot;
	TooltipData tip;

	area = areaOver(position);
	if (area < 0) {
		if (position.x >= window_area.x + help_pos.x && position.y >= window_area.y+help_pos.y && position.x < window_area.x+help_pos.x+help_pos.w && position.y < window_area.y+help_pos.y+help_pos.h) {
			tip.addText(msg->get("Pick up item(s):") + " " + inpt->getBindingString(MAIN1));
			tip.addText(msg->get("Use or equip item:") + " " + inpt->getBindingString(MAIN2) + "\n");
			tip.addText(msg->get("%s modifiers", inpt->getBindingString(MAIN1).c_str()));
			tip.addText(msg->get("Select a quantity of item:") + " " + inpt->getBindingString(SHIFT) + " / " + inpt->getBindingString(SHIFT, INPUT_BINDING_ALT));

			if (inv_ctrl == INV_CTRL_STASH)
				tip.addText(msg->get("Stash item stack:") + " " + inpt->getBindingString(CTRL) + " / " + inpt->getBindingString(CTRL, INPUT_BINDING_ALT));
			else if (inv_ctrl == INV_CTRL_VENDOR || (SELL_WITHOUT_VENDOR && inv_ctrl != INV_CTRL_STASH))
				tip.addText(msg->get("Sell item stack:") + " " + inpt->getBindingString(CTRL) + " / " + inpt->getBindingString(CTRL, INPUT_BINDING_ALT));
		}
		return tip;
	}
	slot = inventory[area].slotOver(position);

	if (slot == -1)
		return tip;

	if (inventory[area][slot].item > 0) {
		tip = inventory[area].checkTooltip(position, stats, PLAYER_INV);
	}
	else if (area == EQUIPMENT && inventory[area][slot].empty()) {
		tip.addText(msg->get(items->getItemType(slot_type[slot])));
	}

	return tip;
}
开发者ID:igorko,项目名称:flare-engine,代码行数:39,代码来源:MenuInventory.cpp


示例8: push

void TooltipManager::push(const TooltipData& _tip_data, const Point& _pos, uint8_t _style) {
	if (_tip_data.isEmpty())
		return;

	tip_data = _tip_data;
	pos = _pos;
	style = _style;
}
开发者ID:clintbellanger,项目名称:flare-engine,代码行数:8,代码来源:TooltipManager.cpp


示例9: getShortTooltip

TooltipData ItemManager::getShortTooltip(ItemStack stack) {
	std::stringstream ss;
	TooltipData tip;

	if (stack.empty()) return tip;

	// name
	if (stack.quantity > 1) {
		ss << stack.quantity << " " << getItemName(stack.item);
	}
	else {
		ss << getItemName(stack.item);
	}
	tip.addColoredText(ss.str(), getItemColor(stack.item));

	return tip;
}
开发者ID:clintbellanger,项目名称:flare-engine,代码行数:17,代码来源:ItemManager.cpp


示例10: checkTooltip

/**
 * On mouseover, show tooltip for buttons
 */
TooltipData MenuActionBar::checkTooltip(const Point& mouse) {
	TooltipData tip;

	if (isWithin(menus[MENU_CHARACTER]->pos, mouse)) {
		if (COLORBLIND && requires_attention[MENU_CHARACTER])
			tip.addText(msg->get("Character") + " (*)");
		else
			tip.addText(msg->get("Character"));
		return tip;
	}
	if (isWithin(menus[MENU_INVENTORY]->pos, mouse)) {
		if (COLORBLIND && requires_attention[MENU_INVENTORY])
			tip.addText(msg->get("Inventory") + " (*)");
		else
			tip.addText(msg->get("Inventory"));
		return tip;
	}
	if (isWithin(menus[MENU_POWERS]->pos, mouse)) {
		if (COLORBLIND && requires_attention[MENU_POWERS])
			tip.addText(msg->get("Powers") + " (*)");
		else
			tip.addText(msg->get("Powers"));
		return tip;
	}
	if (isWithin(menus[MENU_LOG]->pos, mouse)) {
		if (COLORBLIND && requires_attention[MENU_LOG])
			tip.addText(msg->get("Log") + " (*)");
		else
			tip.addText(msg->get("Log"));
		return tip;
	}
	for (unsigned i = 0; i < slots_count; i++) {
		if (hotkeys_mod[i] != 0) {
			if (slots[i] && isWithin(slots[i]->pos, mouse)) {
				tip.addText(powers->powers[hotkeys_mod[i]].name);
			}
		}
	}

	return tip;
}
开发者ID:revcozmo,项目名称:flare-engine,代码行数:44,代码来源:MenuActionBar.cpp


示例11: checkTooltip

/**
 * On mouseover, show tooltip for buttons
 */
TooltipData MenuActionBar::checkTooltip(Point mouse) {
	TooltipData tip;

	if (isWithin(menus[0], mouse)) {
		tip.addText(msg->get("Character Menu (C)"));
		return tip;
	}
	if (isWithin(menus[1], mouse)) {
		tip.addText(msg->get("Inventory Menu (I)"));
		return tip;
	}
	if (isWithin(menus[2], mouse)) {
		tip.addText(msg->get("Power Menu (P)"));
		return tip;
	}
	if (isWithin(menus[3], mouse)) {
		tip.addText(msg->get("Log Menu (L)"));
		return tip;
	}
	for (int i=0; i<12; i++) {
		if (hotkeys[i] != 0) {
			if (isWithin(slots[i], mouse)) {
				tip.addText(powers->powers[hotkeys[i]].name);
			}
		}
	}

	return tip;
}
开发者ID:dgsb,项目名称:flare-engine,代码行数:32,代码来源:MenuActionBar.cpp


示例12: checkTooltip

/**
 * On mouseover, show tooltip for buttons
 */
TooltipData MenuActionBar::checkTooltip(Point mouse) {
	TooltipData tip;

	if (isWithin(menus[MENU_CHARACTER]->pos, mouse)) {
		tip.addText(msg->get("Character"));
		return tip;
	}
	if (isWithin(menus[MENU_INVENTORY]->pos, mouse)) {
		tip.addText(msg->get("Inventory"));
		return tip;
	}
	if (isWithin(menus[MENU_POWERS]->pos, mouse)) {
		tip.addText(msg->get("Powers"));
		return tip;
	}
	if (isWithin(menus[MENU_LOG]->pos, mouse)) {
		tip.addText(msg->get("Log"));
		return tip;
	}
	for (int i=0; i<12; i++) {
		if (hotkeys[i] != 0) {
			if (isWithin(slots[i]->pos, mouse)) {
				tip.addText(powers->powers[hotkeys[i]].name);
			}
		}
	}

	return tip;
}
开发者ID:NathanielSheller,项目名称:flare-engine,代码行数:32,代码来源:MenuActionBar.cpp


示例13: getTooltip

/**
 * Create detailed tooltip showing all relevant item info
 */
TooltipData ItemManager::getTooltip(int item, StatBlock *stats, int context) {
	TooltipData tip;
	SDL_Color color = color_normal;

	if (item == 0) return tip;

	// color quality
	if (items[item].set > 0) {
		color = item_sets[items[item].set].color;
	}
	else if (items[item].quality == ITEM_QUALITY_LOW) {
		color = color_low;
	}
	else if (items[item].quality == ITEM_QUALITY_HIGH) {
		color = color_high;
	}
	else if (items[item].quality == ITEM_QUALITY_EPIC) {
		color = color_epic;
	}

	// name
	tip.addText(items[item].name, color);

	// level
	if (items[item].level != 0) {
		tip.addText(msg->get("Level %d", items[item].level));
	}

	// type
	if (items[item].type != "other") {
		tip.addText(msg->get(getItemType(items[item].type)));
	}

	// damage
	if (items[item].dmg_melee_max > 0) {
		if (items[item].dmg_melee_min < items[item].dmg_melee_max)
			tip.addText(msg->get("Melee damage: %d-%d", items[item].dmg_melee_min, items[item].dmg_melee_max));
		else
			tip.addText(msg->get("Melee damage: %d", items[item].dmg_melee_max));
	}
	if (items[item].dmg_ranged_max > 0) {
		if (items[item].dmg_ranged_min < items[item].dmg_ranged_max)
			tip.addText(msg->get("Ranged damage: %d-%d", items[item].dmg_ranged_min, items[item].dmg_ranged_max));
		else
			tip.addText(msg->get("Ranged damage: %d", items[item].dmg_ranged_max));
	}
	if (items[item].dmg_ment_max > 0) {
		if (items[item].dmg_ment_min < items[item].dmg_ment_max)
			tip.addText(msg->get("Mental damage: %d-%d", items[item].dmg_ment_min, items[item].dmg_ment_max));
		else
			tip.addText(msg->get("Mental damage: %d", items[item].dmg_ment_max));
	}

	// absorb
	if (items[item].abs_max > 0) {
		if (items[item].abs_min < items[item].abs_max)
			tip.addText(msg->get("Absorb: %d-%d", items[item].abs_min, items[item].abs_max));
		else
			tip.addText(msg->get("Absorb: %d", items[item].abs_max));
	}

	// bonuses
	unsigned bonus_counter = 0;
	string modifier;
	while (bonus_counter < items[item].bonus_val.size() && items[item].bonus_stat[bonus_counter] != "") {
		if (items[item].bonus_stat[bonus_counter] == "speed") {
			modifier = msg->get("%d%% Speed", items[item].bonus_val[bonus_counter]);
			if (items[item].bonus_val[bonus_counter] >= 100) color = color_bonus;
			else color = color_penalty;
		} else {
			if (items[item].bonus_val[bonus_counter] > 0) {
				modifier = msg->get("Increases %s by %d",
						items[item].bonus_val[bonus_counter],
						msg->get(items[item].bonus_stat[bonus_counter]));

				color = color_bonus;
			}
			else {
				modifier = msg->get("Decreases %s by %d",
						items[item].bonus_val[bonus_counter],
						msg->get(items[item].bonus_stat[bonus_counter]));

				color = color_penalty;
			}
		}
		tip.addText(modifier, color);
		bonus_counter++;
	}

	// power
	if (items[item].power_desc != "") {
		tip.addText(items[item].power_desc, color_bonus);
	}

	// requirement
	if (items[item].req_val > 0) {
		if (items[item].req_stat == REQUIRES_PHYS) {
//.........这里部分代码省略.........
开发者ID:Bonbadil,项目名称:flare-engine,代码行数:101,代码来源:ItemManager.cpp


示例14: getTooltip

/**
 * Create detailed tooltip showing all relevant item info
 */
TooltipData ItemManager::getTooltip(ItemStack stack, StatBlock *stats, int context) {
	TooltipData tip;

	if (stack.empty()) return tip;

	Color color = getItemColor(stack.item);

	// name
	std::stringstream ss;
	if (stack.quantity == 1)
		ss << getItemName(stack.item);
	else
		ss << getItemName(stack.item) << " (" << stack.quantity << ")";
	tip.addColoredText(ss.str(), color);

	// quest item
	if (items[stack.item].quest_item) {
		tip.addColoredText(msg->get("Quest Item"), font->getColor(FontEngine::COLOR_ITEM_BONUS));
	}

	// only show the name of the currency item
	if (stack.item == eset->misc.currency_id)
		return tip;

	// flavor text
	if (items[stack.item].flavor != "") {
		tip.addColoredText(Utils::substituteVarsInString(items[stack.item].flavor, pc), font->getColor(FontEngine::COLOR_ITEM_FLAVOR));
	}

	// level
	if (items[stack.item].level != 0) {
		tip.addText(msg->get("Level %d", items[stack.item].level));
	}

	// type
	if (items[stack.item].type != "") {
		tip.addText(msg->get(getItemType(items[stack.item].type)));
	}

	// item quality text for colorblind users
	if (settings->colorblind && items[stack.item].quality != "") {
		color = font->getColor(FontEngine::COLOR_WIDGET_NORMAL);
		for (size_t i=0; i<item_qualities.size(); ++i) {
			if (item_qualities[i].id == items[stack.item].quality) {
				tip.addColoredText(msg->get("Quality: %s", msg->get(item_qualities[i].name)), color);
				break;
			}
		}
	}

	// damage
	for (size_t i = 0; i < eset->damage_types.list.size(); ++i) {
		if (items[stack.item].dmg_max[i] > 0) {
			std::stringstream dmg_str;
			dmg_str << eset->damage_types.list[i].name;
			if (items[stack.item].dmg_min[i] < items[stack.item].dmg_max[i]) {
				dmg_str << ": " << items[stack.item].dmg_min[i] << "-" << items[stack.item].dmg_max[i];
				tip.addText(dmg_str.str());
			}
			else {
				dmg_str << ": " << items[stack.item].dmg_max[i];
				tip.addText(dmg_str.str());
			}
		}
	}

	// absorb
	if (items[stack.item].abs_max > 0) {
		if (items[stack.item].abs_min < items[stack.item].abs_max)
			tip.addText(msg->get("Absorb: %d-%d", items[stack.item].abs_min, items[stack.item].abs_max));
		else
			tip.addText(msg->get("Absorb: %d", items[stack.item].abs_max));
	}

	// bonuses
	unsigned bonus_counter = 0;
	while (bonus_counter < items[stack.item].bonus.size()) {
		ss.str("");

		BonusData* bdata = &items[stack.item].bonus[bonus_counter];

		if (bdata->is_speed || bdata->is_attack_speed) {
			if (bdata->value >= 100)
				color = font->getColor(FontEngine::COLOR_ITEM_BONUS);
			else
				color = font->getColor(FontEngine::COLOR_ITEM_PENALTY);
		}
		else {
			if (bdata->value > 0)
				color = font->getColor(FontEngine::COLOR_ITEM_BONUS);
			else
				color = font->getColor(FontEngine::COLOR_ITEM_PENALTY);
		}

		getBonusString(ss, bdata);
		tip.addColoredText(ss.str(), color);
		bonus_counter++;
//.........这里部分代码省略.........
开发者ID:clintbellanger,项目名称:flare-engine,代码行数:101,代码来源:ItemManager.cpp


示例15: getTooltip

/**
 * Create detailed tooltip showing all relevant item info
 */
TooltipData ItemManager::getTooltip(int item, StatBlock *stats, int context) {
	TooltipData tip;
	SDL_Color color = color_normal;

	if (item == 0) return tip;

	// color quality
	if (items[item].set > 0) {
		color = item_sets[items[item].set].color;
	}
	else if (items[item].quality == ITEM_QUALITY_LOW) {
		color = color_low;
	}
	else if (items[item].quality == ITEM_QUALITY_HIGH) {
		color = color_high;
	}
	else if (items[item].quality == ITEM_QUALITY_EPIC) {
		color = color_epic;
	}

	// name
	tip.addText(items[item].name, color);

	// level
	if (items[item].level != 0) {
		tip.addText(msg->get("Level %d", items[item].level));
	}

	// type
	if (items[item].type != "other") {
		tip.addText(msg->get(getItemType(items[item].type)));
	}

	// damage
	if (items[item].dmg_melee_max > 0) {
		if (items[item].dmg_melee_min < items[item].dmg_melee_max)
			tip.addText(msg->get("Melee damage: %d-%d", items[item].dmg_melee_min, items[item].dmg_melee_max));
		else
			tip.addText(msg->get("Melee damage: %d", items[item].dmg_melee_max));
	}
	if (items[item].dmg_ranged_max > 0) {
		if (items[item].dmg_ranged_min < items[item].dmg_ranged_max)
			tip.addText(msg->get("Ranged damage: %d-%d", items[item].dmg_ranged_min, items[item].dmg_ranged_max));
		else
			tip.addText(msg->get("Ranged damage: %d", items[item].dmg_ranged_max));
	}
	if (items[item].dmg_ment_max > 0) {
		if (items[item].dmg_ment_min < items[item].dmg_ment_max)
			tip.addText(msg->get("Mental damage: %d-%d", items[item].dmg_ment_min, items[item].dmg_ment_max));
		else
			tip.addText(msg->get("Mental damage: %d", items[item].dmg_ment_max));
	}

	// absorb
	if (items[item].abs_max > 0) {
		if (items[item].abs_min < items[item].abs_max)
			tip.addText(msg->get("Absorb: %d-%d", items[item].abs_min, items[item].abs_max));
		else
			tip.addText(msg->get("Absorb: %d", items[item].abs_max));
	}

	// bonuses
	unsigned bonus_counter = 0;
	string modifier;
	while (bonus_counter < items[item].bonus_val.size() && items[item].bonus_stat[bonus_counter] != "") {
		if (items[item].bonus_stat[bonus_counter] == "speed") {
			modifier = msg->get("%d\% Speed", items[item].bonus_val[bonus_counter]);
			if (items[item].bonus_val[bonus_counter] >= 100) color = color_bonus;
			else color = color_penalty;
		} else {
			if (items[item].bonus_val[bonus_counter] > 0) {
开发者ID:aapo,项目名称:flare-engine,代码行数:74,代码来源:ItemManager.cpp


示例16: renderTooltips

void GameStateConfigDesktop::renderTooltips(TooltipData& tip_new) {
	GameStateConfigBase::renderTooltips(tip_new);

	if (active_tab == INPUT_TAB && tip_new.isEmpty()) tip_new = joystick_device_lstb->checkTooltip(inpt->mouse);
}
开发者ID:cllpyl,项目名称:flare-engine,代码行数:5,代码来源:GameStateConfigDesktop.cpp


示例17: checkTooltip

/**
 * Show mouseover descriptions of disciplines and powers
 */
TooltipData MenuPowers::checkTooltip(Point mouse) {

	TooltipData tip;

	for (unsigned i=0; i<power_cell.size(); i++) {

		if ((tabs_count > 1) && (tabControl->getActiveTab() != power_cell[i].tab)) continue;

		if (isWithin(slots[i]->pos, mouse)) {
			tip.addText(powers->powers[power_cell[i].id].name);
			if (powers->powers[power_cell[i].id].passive) tip.addText("Passive");
			tip.addText(powers->powers[power_cell[i].id].description);

			if (powers->powers[power_cell[i].id].requires_physical_weapon)
				tip.addText(msg->get("Requires a physical weapon"));
			else if (powers->powers[power_cell[i].id].requires_mental_weapon)
				tip.addText(msg->get("Requires a mental weapon"));
			else if (powers->powers[power_cell[i].id].requires_offense_weapon)
				tip.addText(msg->get("Requires an offense weapon"));


			// add requirement
			if ((power_cell[i].requires_physoff > 0) && (stats->physoff() < power_cell[i].requires_physoff)) {
				tip.addText(msg->get("Requires Physical Offense %d", power_cell[i].requires_physoff), color_penalty);
			}
			else if((power_cell[i].requires_physoff > 0) && (stats->physoff() >= power_cell[i].requires_physoff)) {
				tip.addText(msg->get("Requires Physical Offense %d", power_cell[i].requires_physoff));
			}
			if ((power_cell[i].requires_physdef > 0) && (stats->physdef() < power_cell[i].requires_physdef)) {
				tip.addText(msg->get("Requires Physical Defense %d", power_cell[i].requires_physdef), color_penalty);
			}
			else if ((power_cell[i].requires_physdef > 0) && (stats->physdef() >= power_cell[i].requires_physdef)) {
				tip.addText(msg->get("Requires Physical Defense %d", power_cell[i].requires_physdef));
			}
			if ((power_cell[i].requires_mentoff > 0) && (stats->mentoff() < power_cell[i].requires_mentoff)) {
				tip.addText(msg->get("Requires Mental Offense %d", power_cell[i].requires_mentoff), color_penalty);
			}
			else if ((power_cell[i].requires_mentoff > 0) && (stats->mentoff() >= power_cell[i].requires_mentoff)) {
				tip.addText(msg->get("Requires Mental Offense %d", power_cell[i].requires_mentoff));
			}
			if ((power_cell[i].requires_mentdef > 0) && (stats->mentdef() < power_cell[i].requires_mentdef)) {
				tip.addText(msg->get("Requires Mental Defense %d", power_cell[i].requires_mentdef), color_penalty);
			}
			else if ((power_cell[i].requires_mentdef > 0) && (stats->mentdef() >= power_cell[i].requires_mentdef)) {
				tip.addText(msg->get("Requires Mental Defense %d", power_cell[i].requires_mentdef));
			}
			if ((power_cell[i].requires_offense > 0) && (stats->get_offense() < power_cell[i].requires_offense)) {
				tip.addText(msg->get("Requires Offense %d", power_cell[i].requires_offense), color_penalty);
			}
			else if ((power_cell[i].requires_offense > 0) && (stats->get_offense() >= power_cell[i].requires_offense)) {
				tip.addText(msg->get("Requires Offense %d", power_cell[i].requires_offense));
			}
			if ((power_cell[i].requires_defense > 0) && (stats->get_defense() < power_cell[i].requires_defense)) {
				tip.addText(msg->get("Requires Defense %d", power_cell[i].requires_defense), color_penalty);
			}
			else if ((power_cell[i].requires_defense > 0) && (stats->get_defense() >= power_cell[i].requires_defense)) {
				tip.addText(msg->get("Requires Defense %d", power_cell[i].requires_defense));
			}
			if ((power_cell[i].requires_physical > 0) && (stats->get_physical() < power_cell[i].requires_physical)) {
				tip.addText(msg->get("Requires Physical %d", power_cell[i].requires_physical), color_penalty);
			}
			else if ((power_cell[i].requires_physical > 0) && (stats->get_physical() >= power_cell[i].requires_physical)) {
				tip.addText(msg->get("Requires Physical %d", power_cell[i].requires_physical));
			}
			if ((power_cell[i].requires_mental > 0) && (stats->get_mental() < power_cell[i].requires_mental)) {
				tip.addText(msg->get("Requires Mental %d", power_cell[i].requires_mental), color_penalty);
			}
			else if ((power_cell[i].requires_mental > 0) && (stats->get_mental() >= power_cell[i].requires_mental)) {
				tip.addText(msg->get("Requires Mental %d", power_cell[i].requires_mental));
			}

			// Draw required Level Tooltip
			if ((power_cell[i].requires_level > 0) && stats->level < power_cell[i].requires_level) {
				tip.addText(msg->get("Requires Level %d", power_cell[i].requires_level), color_penalty);
			}
			else if ((power_cell[i].requires_level > 0) && stats->level >= power_cell[i].requires_level) {
				tip.addText(msg->get("Requires Level %d", power_cell[i].requires_level));
			}

			// Draw required Skill Point Tooltip
			if ((power_cell[i].requires_point) &&
					!(find(stats->powers_list.begin(), stats->powers_list.end(), power_cell[i].id) != stats->powers_list.end()) &&
					(points_left < 1)) {
				tip.addText(msg->get("Requires %d Skill Point", power_cell[i].requires_point), color_penalty);
			}
			else if ((power_cell[i].requires_point) &&
					 !(find(stats->powers_list.begin(), stats->powers_list.end(), power_cell[i].id) != stats->powers_list.end()) &&
					 (points_left > 0)) {
				tip.addText(msg->get("Requires %d Skill Point", power_cell[i].requires_point));
			}

			// Draw unlock power Tooltip
			if (power_cell[i].requires_point &&
					!(find(stats->powers_list.begin(), stats->powers_list.end(), power_cell[i].id) != stats->powers_list.end()) &&
					(points_left > 0) &&
					powerUnlockable(power_cell[i].id) && (points_left > 0)) {
				tip.addText(msg->get("Click to Unlock"), color_bonus);
//.........这里部分代码省略.........
开发者ID:Puros,项目名称:flare-engine,代码行数:101,代码来源:MenuPowers.cpp


示例18: renderTooltips

void GameStateConfigBase::renderTooltips(TooltipData& tip_new) {
	if (active_tab == INTERFACE_TAB && tip_new.isEmpty()) tip_new = language_lstb->checkTooltip(inpt->mouse);
	if (active_tab == MODS_TAB && tip_new.isEmpty()) tip_new = activemods_lstb->checkTooltip(inpt->mouse);
	if (active_tab == MODS_TAB && tip_new.isEmpty()) tip_new = inactivemods_lstb->checkTooltip(inpt->mouse);
}
开发者ID:sudoman,项目名称:flare-engine,代码行数:5,代码来源:GameStateConfigBase.cpp


示例19: getTooltip

/**
 * Create detailed tooltip showing all relevant item info
 */
TooltipData ItemManager::getTooltip(ItemStack stack, StatBlock *stats, int context) {
	TooltipData tip;

	if (stack.empty()) return tip;

	Color color = getItemColor(stack.item);

	// name
	std::stringstream ss;
	if (stack.quantity == 1)
		ss << getItemName(stack.item);
	else
		ss << getItemName(stack.item) << " (" << stack.quantity << ")";
	tip.addText(ss.str(), color);

	// quest item
	if (items[stack.item].quest_item) {
		tip.addText(msg->get("Quest Item"), color_bonus);
	}

	// only show the name of the currency item
	if (stack.item == CURRENCY_ID)
		return tip;

	// flavor text
	if (items[stack.item].flavor != "") {
		tip.addText(substituteVarsInString(items[stack.item].flavor, pc), color_flavor);
	}

	// level
	if (items[stack.item].level != 0) {
		tip.addText(msg->get("Level %d", items[stack.item].level));
	}

	// type
	if (items[stack.item].type != "") {
		tip.addText(msg->get(getItemType(items[stack.item].type)));
	}

	// item quality text for colorblind users
	if (COLORBLIND && items[stack.item].quality != "") {
		color = color_normal;
		for (size_t i=0; i<item_qualities.size(); ++i) {
			if (item_qualities[i].id == items[stack.item].quality) {
				tip.addText(msg->get("Quality: %s", msg->get(item_qualities[i].name)), color);
				break;
			}
		}
	}

	// damage
	if (items[stack.item].dmg_melee_max > 0) {
		if (items[stack.item].dmg_melee_min < items[stack.item].dmg_melee_max)
			tip.addText(msg->get("Melee damage: %d-%d", items[stack.item].dmg_melee_min, items[stack.item].dmg_melee_max));
		else
			tip.addText(msg->get("Melee damage: %d", items[stack.item].dmg_melee_max));
	}
	if (items[stack.item].dmg_ranged_max > 0) {
		if (items[stack.item].dmg_ranged_min < items[stack.item].dmg_ranged_max)
			tip.addText(msg->get("Ranged damage: %d-%d", items[stack.item].dmg_ranged_min, items[stack.item].dmg_ranged_max));
		else
			tip.addText(msg->get("Ranged damage: %d", items[stack.item].dmg_ranged_max));
	}
	if (items[stack.item].dmg_ment_max > 0) {
		if (items[stack.item].dmg_ment_min < items[stack.item].dmg_ment_max)
			tip.addText(msg->get("Mental damage: %d-%d", items[stack.item].dmg_ment_min, items[stack.item].dmg_ment_max));
		else
			tip.addText(msg->get("Mental damage: %d", items[stack.item].dmg_ment_max));
	}

	// absorb
	if (items[stack.item].abs_max > 0) {
		if (items[stack.item].abs_min < items[stack.item].abs_max)
			tip.addText(msg->get("Absorb: %d-%d", items[stack.item].abs_min, items[stack.item].abs_max));
		else
			tip.addText(msg->get("Absorb: %d", items[stack.item].abs_max));
	}

	// bonuses
	unsigned bonus_counter = 0;
	while (bonus_counter < items[stack.item].bonus.size()) {
		ss.str("");

		BonusData* bdata = &items[stack.item].bonus[bonus_counter];

		if (bdata->is_speed) {
			ss << msg->get("%d%% Speed", bdata->value);
			if (bdata->value >= 100) color = color_bonus;
			else color = color_penalty;
		}
		else {
			if (bdata->value > 0) {
				color = color_bonus;
			}
			else {
				color = color_penalty;
			}
//.........这里部分代码省略.........
开发者ID:mactec0,项目名称:flare-engine,代码行数:101,代码来源:ItemManager.cpp



注:本文中的TooltipData类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ToonzScene类代码示例发布时间:2022-05-31
下一篇:
C++ Tooltip类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap