void World::addShields()
{
	sf::Vector2f position(85.f, 150.f);

	addShield(position.x, position.y);
	addShield(-position.x, position.y);
	addShield(position.x * 3 - 5.f, position.y);
	addShield(-position.x * 3 + 5.f, position.y );
}
void WayRenderer::shield(cairo_t* cr,
		std::list<shared_ptr<Shield> >& shields,
		AssetCache& cache)
{
	if (s->shield_text.str().size() == 0 || s->font_size <= 0.0)
		return;

	// make sure path is initialized
	addWayPath(cr);
	cairo_new_path(cr);

	cairo_save(cr);

	cairo_set_font_size(cr, s->font_size);

	cairo_select_font_face(cr,
				s->font_family.c_str(),
				s->font_style == Style::STYLE_ITALIC ? CAIRO_FONT_SLANT_ITALIC : CAIRO_FONT_SLANT_NORMAL,
				s->font_weight == Style::WEIGHT_BOLD ? CAIRO_FONT_WEIGHT_BOLD : CAIRO_FONT_WEIGHT_NORMAL
			);

	cairo_text_extents_t textSize;
	cairo_text_extents(cr, s->shield_text.c_str(), &textSize);

	std::list<FloatPoint> positions;
	getShieldPosition(path, positions);

	for (FloatPoint& p : positions)
	{
		addShield(shields, p, &textSize);
	}

	cairo_restore(cr);
}
Beispiel #3
0
void NodeRenderer::shield(const Cairo::RefPtr<Cairo::Context>& cr,
		std::list<shared_ptr<Shield> >& shields,
		AssetCache& cache)
{
	// nothing to print
	if (s->shield_text.str().size() == 0 || s->font_size <= 0)
		return;

	cr->save();

	cr->set_font_size(s->font_size);

	cr->set_font_face(cache.getFont(
			s->font_family.str(),
			s->font_style == Style::STYLE_ITALIC ? Cairo::FONT_SLANT_ITALIC : Cairo::FONT_SLANT_NORMAL,
			s->font_weight == Style::WEIGHT_BOLD ? Cairo::FONT_WEIGHT_BOLD : Cairo::FONT_WEIGHT_NORMAL
		));

	Cairo::TextExtents textSize;
	cr->get_text_extents(s->shield_text.str(), textSize);

	addShield(shields, location, textSize);

	cr->restore();
}
Beispiel #4
0
void NodeRenderer::shield(const Cairo::RefPtr<Cairo::Context>& cr,
		std::list<shared_ptr<Shield> >& shields)
{
	// nothing to print
	if (s->shield_text.str().size() == 0 || s->font_size <= 0)
		return;

	cr->save();

	cr->set_font_size(s->font_size);

	Cairo::TextExtents textSize;
	cr->get_text_extents(s->shield_text.str(), textSize);

	addShield(shields, location, textSize);

	cr->restore();
}
Beispiel #5
0
// add points from removed tile
void Player::addPoints(const ScoredTile& tile)
{
    if ( tile.getTile().isBomb() )
    {
        // direct damage from bomb for opponent
        m_bombDamage += tile.getBombValue();
#ifdef DEBUG        
        std::cout << "Player::addPoints() info: "
                  << "add " << tile.getBombValue()
                  << " bomb damage" << std::endl;
#endif 
    }
    else
    {
        switch ( tile.getTile().getType() )
        {
            case Tile::TILE_RED:
                m_redPoints += tile.getLength();
#ifdef DEBUG        
                std::cout << "Player::addPoints() info: "
                          << "add " << tile.getLength()
                          << " red points" << std::endl;
#endif 
                break;
            case Tile::TILE_GREEN:
                m_greenPoints += tile.getLength();
#ifdef DEBUG        
                std::cout << "Player::addPoints() info: "
                          << "add " << tile.getLength()
                          << " green points" << std::endl;
#endif 
                break;
            case Tile::TILE_YELLOW:
                m_yellowPoints += tile.getLength();
#ifdef DEBUG        
                std::cout << "Player::addPoints() info: "
                          << "add " << tile.getLength()
                          << " yellow points" << std::endl;
#endif 
                break;
            case Tile::TILE_LILAC:
                m_lilacPoints += tile.getLength();
#ifdef DEBUG        
                std::cout << "Player::addPoints() info: "
                          << "add " << tile.getLength()
                          << " lilac points" << std::endl;
#endif 
                break;
            case Tile::TILE_SHIELD:
                addShield(tile.getLength());
#ifdef DEBUG
                std::cout << "Player::addPoints() info: "
                          << "add " << tile.getLength()
                          << " shield" << std::endl;
#endif 
                break;
            default:
                break;
        }
    }
}