bool mainLoopState = true; // アニメーションを終了させる際にfalseにする while( mainLoopState ){ /* この中が無限ループ: ここに描画などの処理を記述する */ }