あなたのアドバイスが必要です。私はSFMLを使用していますので、mouseclickイベント後にスプライトシートからアニメーションを再生する必要があります(fe。64フレームと40ピクセル幅/各フレームの高さ)。私が来ている唯一の解決策は以下のとおりです。sfmlアニメーション後の爆発アニメーション
if (event.type == sf::Event::MouseButtonPressed) {
if (event.key.code == sf::Mouse::Left) {
float frame = 0;
float frameCount = 64;
float animSpeed = 0.005;
while (frame < frameCount) {
spriteAnimation->setTextureRect(sf::IntRect(int(frame)*w, 0, w, w));
frame += animSpeed;
window->draw(rect); // clear the area of displaying animation
window->draw(*spriteAnimation);
window->display();
}
...
しかし、ウィンドウ - >ディスプレイ()何度も呼び出すことは本当に良いではありません。 あなたはより良いバリエーションを提案できますか?
ゲームの最後にdisplay window()を呼び出すと、そのループが最適です –