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); } //} }
void YGroup::move(int s, int e){ if (getMoveMode() == -1){ //시작점 2 sPoint.x += s; sPoint.y += e; YObject* tmp; POSITION pos = groupList.GetHeadPosition(); while (pos){ tmp = groupList.GetNext(pos); if (tmp->getType() == line){ YLine* pL = (YLine*)tmp; pL->setMoveMode(-1); pL->move(s, e); } else if (tmp->getType() == polyline){ YPolyLine* pPL = (YPolyLine*)tmp; pPL->setMoveMode(-1); pPL->move(s, e); } else if (tmp->getType() == ellipse){ YEllipse* pE = (YEllipse*)tmp; pE->setMoveMode(-1); pE->move(s, e); } else if (tmp->getType() == rectangle){ YRectangle* pR = (YRectangle*)tmp; pR->setMoveMode(-1); pR->move(s, e); } } } else if (getMoveMode() == 1)//끝점 4 { ePoint.x += s; ePoint.y += e; YObject* tmp; POSITION pos = groupList.GetHeadPosition(); while (pos){ tmp = groupList.GetNext(pos); if (tmp->getType() == line){ YLine* pL = (YLine*)tmp; pL->setMoveMode(1); pL->move(s, e); } else if (tmp->getType() == polyline){ YPolyLine* pPL = (YPolyLine*)tmp; pPL->setMoveMode(1); pPL->move(s, e); } else if (tmp->getType() == ellipse){ YEllipse* pE = (YEllipse*)tmp; pE->setMoveMode(1); pE->move(s, e); } else if (tmp->getType() == rectangle){ YRectangle* pR = (YRectangle*)tmp; pR->setMoveMode(1); pR->move(s, e); } } } else if (getMoveMode() == 2)// 4 { ePoint.x += s; sPoint.y += e; YObject* tmp; POSITION pos = groupList.GetHeadPosition(); while (pos){ tmp = groupList.GetNext(pos); if (tmp->getType() == ellipse){ YEllipse* pE = (YEllipse*)tmp; pE->setMoveMode(3); pE->move(s, e); } else if (tmp->getType() == rectangle){ YRectangle* pR = (YRectangle*)tmp; pR->setMoveMode(3); pR->move(s, e); } } } else if (getMoveMode() == 3)// 3 { sPoint.x += s; ePoint.y += e; YObject* tmp; POSITION pos = groupList.GetHeadPosition(); while (pos){ tmp = groupList.GetNext(pos); if (tmp->getType() == ellipse){ YEllipse* pE = (YEllipse*)tmp; pE->setMoveMode(2); pE->move(s, e); } else if (tmp->getType() == rectangle){ YRectangle* pR = (YRectangle*)tmp; pR->setMoveMode(2); pR->move(s, e); } } } }