コード例 #1
0
ファイル: SpellItem.cpp プロジェクト: m-irigoyen/rpg-runes
void SpellItem::focusOutEvent(QFocusEvent * event)
{
	if (this->parentItem() == NULL)
		colorCenterPart(true);

	this->setBrush(QBrush(colorBackground()));
	checkColorCenter();
	this->scene()->update();
}
コード例 #2
0
ファイル: giimagep.cpp プロジェクト: acekiller/touchvg
HBITMAP GiGdipImage::createBitmap(GiColor bkColor) const
{
    HBITMAP hBmp = NULL;

    if (m_impl->bmp != NULL)
    {
        G::Color colorBackground(bkColor.r, bkColor.g, bkColor.b);
        m_impl->bmp->GetHBITMAP(colorBackground, &hBmp);
    }

    return hBmp;
}
コード例 #3
0
ファイル: line.c プロジェクト: PierrickJACQUETTE/CPROJ
void parcourList(ListWay *l){
	if(l != NULL){
		int coastline = 0;
		refListWay * current = l->firstRef;
		while(current != NULL){
			Way * currentWay = searchWay(map->avlWay,current->way);
			if(currentWay != NULL){
				if((currentWay->draw == drawNumber) && (strcmp(currentWay->visible,"T") == 0)){
					// case coastline
					if(strcmp(currentWay->tag->tagValue, "coastline") ==0){
						drawContour = 0;
						if(coastline == 0){
							colorBackground(0,102,205,100);
							coastline = 1;
							SDL_RenderClear(renderer);
							analyseCoastline(currentWay, map);
						}
						else{
							analyseCoastline(currentWay, map);
						}
						fillWay(currentWay);
						currentWay->draw ++;
						drawContour = 1;
					}
					else {
						fillWay(currentWay);
						currentWay->draw ++;
					}
				}
				else if((strcmp(currentWay->visible,"F") !=0) && (currentWay->draw <= drawNumber) ){
					fprintf(stderr," fd Le champs visible du way %ld ne vaut ni true ni false mais %s \n",currentWay->id,currentWay->visible );
				}
			}
			else{
				fprintf(stderr,"Le way %ld n'est pas définis dans le fichier d'entree dans line parcourList\n",current->way );
			}
			current = current->next;
		}
	}
}
コード例 #4
0
ファイル: RuneItem.cpp プロジェクト: m-irigoyen/rpg-runes
	void RuneItem::drawSpell()
	{
		if (parent_ == NULL)
		{
			cout << "ERROR : RuneItems must have a parent" << endl;
			abort();
		}

		this->setParentItem(parent_);
		this->setPen(this->getDefaultPen());
		this->setBrush(QBrush(colorBackground()));

		// Empty spell : only display the inner circle

		// If the spell isn't empty
		if (spell_->getRune() != -1)
		{
			// Setting the text
			text_.setParentItem(this);
			RuneDescriptor* rd = NULL;
			if (runeEngine_.isMasterMode())
				rd = &runes_->at(spell_->getRune())->descriptor_;
			else
				rd = &userRunes_->at(spell_->getRune());
			text_.setText(rd->naturalName_);
			text_.setPos(-text_.boundingRect().width() / 2, -text_.boundingRect().height() / 2);
			text_.hide();

			// Displaying the rune
			image_.setParentItem(this);
			resetImage();
			image_.setPos(-_GRAPHICS_SPELLITEM_RUNE_IMAGERADIUS, -_GRAPHICS_SPELLITEM_RUNE_IMAGERADIUS);
		}

		this->setRect(-_GRAPHICS_SPELLITEM_RUNE_IMAGERADIUS, -_GRAPHICS_SPELLITEM_RUNE_IMAGERADIUS,
			_GRAPHICS_SPELLITEM_RUNE_IMAGERADIUS * 2, _GRAPHICS_SPELLITEM_RUNE_IMAGERADIUS * 2);
	}
コード例 #5
0
ファイル: SpellItem.cpp プロジェクト: m-irigoyen/rpg-runes
void SpellItem::drawSpell()
{
	Q_ASSERT(spell_ != NULL);

	// Setting brush
	this->setPen(this->getDefaultPen());
	this->setBrush(QBrush(colorBackground()));

	float innerRadius = 0.0f;
	float outerRadius = 0.0f;

	// Center part
	if (spell_->isCenterSpell())
	{
		innerSpell_ = new SpellItem(spell_->getCenterSpell(), this, runeImages_, runeEngine_);
		innerSpell_->drawSpell();

		innerRadius = innerSpell_->getTotalRadius();

		// 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);
}
コード例 #6
0
ファイル: RuneItem.cpp プロジェクト: m-irigoyen/rpg-runes
	void RuneItem::focusOutEvent(QFocusEvent * event)
	{
		this->setBrush(QBrush(colorBackground()));
		this->scene()->update();
	}