最近,我开始在Visual Studio中使用SFML制作游戏。设置好一切并编写了一些示例代码后,我得到了这个结果:
#include <SFML/Graphics.hpp>
int main()
{
sf::RenderWindow window(sf::VideoMode(600, 600), "Move the Shape");
sf::CircleShape shape(100.f);
shape.setFillColor(sf::Color::Green);
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear();
window.draw(shape);
window.display();
}
return 0;
}
程序会产生以下结果:
![将形状移出中心](https://istack.dev59.com/PjCUg.webp)
setOrigin
部分的内容。 - Eitan Myron