예제 #1
0
파일: Bee.cpp 프로젝트: fokasand/projetprog
void Bee::drawOn(sf::RenderTarget& target) const 
{
	//if (!isInHive_)
	//{
		auto beeSprite = buildSprite(centre, rayon, texture_);
		
		if (( speed_.angle() >= M_PI/2) or (speed_.angle() <= -M_PI/2))
		{
				beeSprite.scale(1, -1);
		}
		beeSprite.rotate(speed_.angle()/DEG_TO_RAD);
		
		target.draw(beeSprite);
		
		if(isDebugOn())
		{
			//couleur et épaisseur du cercle dependent de l'état de mouvement de l'abeille
			sf::Color color = (getMoveMode()==Random) ? sf::Color::Black : sf::Color::Blue; 
			double size (rayon+1);
			double thickness = (getMoveMode()==Random) ? 5 : 3;
			auto shape = buildAnnulus(centre, size, color, thickness);
			target.draw(shape);
			Vec2d affiche (centre.x,centre.y +20);
			auto const text = buildText(statestring_, affiche , getAppFont(), 10, sf::Color::White);
			target.draw(text);
		}   
	//}
}
예제 #2
0
void
WorkerBee::drawDebug(sf::RenderTarget& target) const
{
    std::string valueString;
    sf::Color color(sf::Color::Magenta);
    Vec2d position;
    double text_size(getAppEnv().getTextSize());

    position.x = this->getPosition().x;
    position.y = this->getPosition().y + text_size;

    valueString = "Worker: energy " + to_nice_string(this->getEnergy());
    sf::Text text = buildText(valueString, position, getAppFont(), text_size,
                              color);
    target.draw(text);

    position.y = position.y + text_size;
    sf::Text status = buildText(this->getDebugStatus(), position,
                                getAppFont(), text_size, color);
    target.draw(status);
}