Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/127.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 围绕对象中心的SFML旋转_C++_Sfml - Fatal编程技术网

C++ 围绕对象中心的SFML旋转

C++ 围绕对象中心的SFML旋转,c++,sfml,C++,Sfml,我这里有一个代码: void Star::createStar(){ sf::CircleShape star1(r,50); star1.setPosition(x,y); sf::Texture* t = CreateTexture(256,256); star1.setTexture(t,false); star=star1; std::cout << "Done!"<<std::endl; } void Star::update(){ star.setOrigin

我这里有一个代码:

void Star::createStar(){
sf::CircleShape star1(r,50);
star1.setPosition(x,y);
sf::Texture* t = CreateTexture(256,256);
star1.setTexture(t,false);
star=star1;
std::cout << "Done!"<<std::endl;
}
void Star::update(){
star.setOrigin(x-(.5*r),y-(.5*r));

star.rotate(0.01);
}
void Star::createStar(){
sf::圆形星1(r,50);
star1.设定位置(x,y);
sf::Texture*t=CreateTexture(256256);
star1.setTexture(t,false);
星=星1;

这是正确的代码

void Star::createStar(){
sf::CircleShape star1(r,50);
star1.setPosition(x,y);
sf::Texture* t = CreateTexture(256,256);
star1.setTexture(t,false);
star=star1;
std::cout << "Done!"<<std::endl;
}
void Star::update(){
//star.setOrigin(x-(.5*r),y-(.5*r));
//no need to set origin
star.rotate(0.01);
}
void Star::createStar(){
sf::圆形星1(r,50);
star1.设定位置(x,y);
sf::Texture*t=CreateTexture(256256);
star1.setTexture(t,false);
星=星1;

std::请提交您的解决方案并选择正确的解决方案。