本文整理汇总了C++中sf::Sprite::rotate方法的典型用法代码示例。如果您正苦于以下问题:C++ Sprite::rotate方法的具体用法?C++ Sprite::rotate怎么用?C++ Sprite::rotate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sf::Sprite
的用法示例。
在下文中一共展示了Sprite::rotate方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setTexture
void cursor::setTexture(string cursorPass)
{
sprite.setTexture(textureManager.get(cursorPass));
sprite.setOrigin((Collision::GetSpriteSize(sprite).x / sprite.getScale().x / 2), (Collision::GetSpriteSize(sprite).y / sprite.getScale().y / 2));
sprite.rotate(-90);
sprite.setColor(sf::Color(255, 255, 255, settings.getCursorAplha()));
}
示例2: rotateSprite
// Setters
void rotateSprite(float angle)
{
// sf::FloatRect bounds = mSprite.getLocalBounds();
// mSprite.setOrigin
mSprite.rotate(angle);
}
示例3: transformSprite
void GraphicEngine::transformSprite(sf::Sprite& sprite, const Transformation& t, const Color& color)
{
if (t.hasPosition())
sprite.setPosition((float)t.getX(), (float)t.getY());
if (t.hasRotation())
sprite.rotate(t.getRotation());
if (color.isUsed())
sprite.setColor(sf::Color(color.getColor()));
if (t.hasScale())
sprite.setScale(t.getScaleX(), t.getScaleY());
}
示例4: update
//iterate function draw
sf::Sprite& update() {
graphTx.update(graph);
graphSpr.rotate(rotation * 180. / pi);
return graphSpr;
}
示例5: pv
//.........这里部分代码省略.........
}
angle = -30;
break;}
case NordOuest : {
moobOffSetX = -moobAvancement / 2 ;
moobOffSetY = -moobAvancement * (sqrt(3)/2) ;
if ( etape == 0)
{
moobOffSetX += (sqrt(3)/2) *cote /2;
moobOffSetY += (sqrt(3)/2) *cote *(sqrt(3)/2);
}
angle = 30;
break;}
case Ouest : {
moobOffSetX = - moobAvancement;
moobOffSetY = 0;
if ( etape == 0)
{
moobOffSetX += (sqrt(3)/2) *cote;
}
angle = 90;
break;}
case SudOuest : {
angle = 160;
moobOffSetX = -moobAvancement / 2 ;
moobOffSetY = moobAvancement * (sqrt(3)/2) ;
if ( etape == 0)
{
moobOffSetX += (sqrt(3)/2) *cote /2;
moobOffSetY -= (sqrt(3)/2) *cote *(sqrt(3)/2);
}
break;}
case SudEst: {
angle = -160;
moobOffSetX = moobAvancement / 2 ;
moobOffSetY = moobAvancement * (sqrt(3)/2) ;
if ( etape == 0)
{
moobOffSetX -= (sqrt(3)/2) *cote /2;
moobOffSetY -= (sqrt(3)/2) *cote *(sqrt(3)/2);
}
break;}
}
SpriteMoob.move(moobOffSetX,moobOffSetY);
//double centreX = SpriteMoob.getSize().x/2;
// double centreY = SpriteMoob.getSize().y/2 ;
double centreX = SpriteMoob.getTextureRect().width /2 ;// SpriteTower.getTexture().getSize().x/2;
double centreY = SpriteMoob.getTextureRect().height/2 ;
SpriteMoob.setPosition(centreX,centreY);
SpriteMoob.rotate(angle);
pv. move(moobOffSetX-centreX,moobOffSetY-centreY);
App.draw(pv);
App.draw(SpriteMoob);
//la gestion de l'attaque n'est pas encore definie
if ( monMoob != NULL )
{
using namespace std;
Case* laCase = monMoob->CaseCourante();
if (laCase != NULL )
{
std::list<Tour*>::iterator itt = listTour.begin();
for ( itt; itt != listTour.end() ; ++itt)
{
if ( (*itt)->getCible() == monMoob)
{
sf::Vector2<int> ij;
sf::Vector2<double>xy;
ij.x = (*itt)->getPosition()->getI();
ij.y = (*itt)->getPosition()->getJ();
xy = IJtoXY (ij, cote, offSetX, offSetY);
// sf::Shape Line = sf::Shape::Line(SpriteMoob.GetPosition().x,SpriteMoob.GetPosition().y,xy.x,xy.y, 2, sf::Color::Red);
// App.Draw(Line);
}
}
}
}
}
示例6: rotate
void rotate(float rotation){ mSprite.rotate(rotation); }