我开始与SFML 2.1但我不能找到如何使程序运行流体SFML - 流体屏幕更新?
我的意思是,该方案的工作,但除非我做一些事情,比如按下按钮或移动鼠标,主循环不会运行,
这里是我的主循环代码
window.setFramerateLimit(30); // set max fps to 30
while (window.isOpen())
{
// this code ignores the framerate limit and doesnt runs when an event is found
while (window.pollEvent(event))
{
// this code works fine but it wont run unless the user presses a key or moves the mouse
}
}
任何想法的例子吗?
[这是它应该工作的方式(http://sfml-dev.org/documentation/2.1/classsf_1_1Window.php#a338e996585faf82e93069858e3b531b7),该代码应该在“while(window.pollEvent(event))'循环之外添加运行”always“。 – fvu
你应该阅读[tutorials](http://sfml-dev.org/tutorials/2.1/),它们对于使用SFML是必不可少的。例如, –
如果我想要一个精灵向左移动,我应该怎么做? – user2953006