【发布时间】:2014-02-13 02:24:09
【问题描述】:
所以最近,我开始使用 SFML 在 Visual Studio 中制作游戏。 在设置完所有内容并编写了一些示例代码后,我设计了这个:
#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;
}
程序产生以下结果:
如何将圆圈放在中心?之后我想设置一些代码,让用户使用键盘的箭头键移动圆圈,所以我需要圆圈在中心。
【问题讨论】:
标签: c++ visual-c++ visual-studio-2012 sfml