我開始與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