【发布时间】:2014-01-03 13:10:55
【问题描述】:
我试图在 SFML 2.1 中显示 5 秒的启动画面,显示显示在主游戏循环中,但在 init 方法中,没有显示,图标在 Dock 上显示 5 秒,但没有窗口.. .
int initGame(){
gameState = GAME_LOADING;
// Create the main window
window.create(mainVideoMode, "SFML Window", sf::Style::Default);
// Set the Icon
if (!icon.loadFromFile(resourcePath() + "icon.png")) {
gameState = GAME_EXIT;
}
sf::Texture texture;
if (!texture.loadFromFile(resourcePath() + "splashscreen.png"))
{
gameState = GAME_EXIT;
}
window.setIcon(icon.getSize().x, icon.getSize().y, icon.getPixelsPtr());
sf::Sprite sprite(texture);
window.clear();
window.draw(sprite);
window.display();
// Create a graphical text to display
/*if (!font.loadFromFile(resourcePath() + "sansation.ttf")) { If Needed
return EXIT_FAILURE;
}*/
sf::sleep(sf::seconds(5));
gameState = GAME_PLAYING;
return 1;
}
【问题讨论】:
标签: c++ game-engine sfml