当前位置: 首页>>代码示例>>C++>>正文


C++ SpellItem::setScale方法代码示例

本文整理汇总了C++中SpellItem::setScale方法的典型用法代码示例。如果您正苦于以下问题:C++ SpellItem::setScale方法的具体用法?C++ SpellItem::setScale怎么用?C++ SpellItem::setScale使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SpellItem的用法示例。


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

示例1: drawSpell


//.........这里部分代码省略.........

		// Positioning outer circle
		this->setRect(-outerRadius, -outerRadius, outerRadius * 2, outerRadius * 2);
	}
	else
	{
		innerRune_ = new RuneItem(spell_, this, runeImages_, runeEngine_);
		innerRune_->drawSpell();
		connect(innerRune_, SIGNAL(requestRedraw()),
			this, SLOT(redraw()));

		innerRadius = this->getInnerRadius();
	}

	// Creating and positioning components and their paths
	if (!spell_->getComponents().empty())
	{
		// Creating
		vector<Spell*> spellComponents = spell_->getComponents();
		for (Spell* comp : spellComponents)
		{
			SpellItem* ri = new SpellItem(comp, this, runeImages_, runeEngine_);
			ri->drawSpell();
			this->components_.push_back(ri);
		}

		// Positioning components
		float componentRadius = this->getBiggestComponentRadius();
		componentRadius += innerRadius + _GRAPHICS_SPELLITEM_DISTANCE;
		int i = 0;
		for (SpellItem* ri : components_)
		{
			QPointF pos = getPositionOnSpell(i, this->components_.size(), componentRadius, this->pos());
			ri->setPos(pos);
			this->positionPath(ri, innerRadius);
			++i;
		}

		outerRadius = this->getTotalRadius();
		this->setRect(-outerRadius, -outerRadius, outerRadius * 2, outerRadius * 2);
	}
	else
		outerRadius = innerRadius;

	// Creating and positioning children and their paths
	if (!spell_->getChildren().empty())
	{
		// Creating
		vector<Spell*> spellChildren = spell_->getChildren();
		for (Spell* child : spellChildren)
		{
			// Components
			SpellItem* ri = new SpellItem(child, this, runeImages_, runeEngine_);
			ri->drawSpell();
			this->children_.push_back(ri);
		}

		// Positioning
		float biggestChildRadius = this->getBiggestChildrenRadius();
		biggestChildRadius += outerRadius + _GRAPHICS_SPELLITEM_DISTANCE;
		int i = 0;
		for (SpellItem* ri : children_)
		{
			QPointF pos = getModifierPositionOnSpell(i,
				children_.size(),
				biggestChildRadius,
				this->pos());
			ri->setPos(pos);
			this->positionPath(ri, outerRadius);
			++i;
		}
	}

	// Creating and positioning modifiers
	if (!spell_->getModifiers().empty())
	{
		// Creating
		vector<Spell*> spellModifiers = spell_->getModifiers();
		for (Spell* mod : spellModifiers)
		{
			// Components
			SpellItem* ri = new SpellItem(mod, this, runeImages_, runeEngine_);
			ri->setScale(0.5f);
			ri->drawSpell();
			this->modifiers_.push_back(ri);
		}

		// Positioning
		int i = 0;
		for (SpellItem* ri : modifiers_)
		{
			QPointF pos = getPositionOnSpell(i, modifiers_.size(), innerRadius, this->pos());
			ri->setPos(pos);
			++i;
		}
	}

	if (this->parentItem() == NULL)
		colorCenterPart(true);
}
开发者ID:m-irigoyen,项目名称:rpg-runes,代码行数:101,代码来源:SpellItem.cpp


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