diff --git a/src/sj/AbstractGame.d b/src/sj/AbstractGame.d index ec86e92..fcc5f5a 100644 --- a/src/sj/AbstractGame.d +++ b/src/sj/AbstractGame.d @@ -11,13 +11,17 @@ class AbstractGame { public: /// this(SceneInterface first_scene) in (first_scene) { - next_scene_ = first_scene; + scene_ = first_scene; } /// void Update(KeyInput input) { - scene_ = next_scene_; - next_scene_ = scene_.Update(input); + while (true) { + auto next_scene = scene_.Update(input); + if (next_scene is scene_) break; + + scene_ = next_scene; + } } /// void Draw() { @@ -26,6 +30,4 @@ class AbstractGame { private: SceneInterface scene_; - - SceneInterface next_scene_; } diff --git a/src/sj/LoadingScene.d b/src/sj/LoadingScene.d index c704309..c9e6cb2 100644 --- a/src/sj/LoadingScene.d +++ b/src/sj/LoadingScene.d @@ -105,7 +105,6 @@ class LoadingScene : SceneInterface { return this; } override void Draw() { - if (anime_.isFinished) return; lobby_.Draw(); loading_text_.Draw(lobby_.Projection, lobby_.view.Create()); } diff --git a/src/sj/PlayScene.d b/src/sj/PlayScene.d index 5acfde0..4e8b949 100644 --- a/src/sj/PlayScene.d +++ b/src/sj/PlayScene.d @@ -49,6 +49,8 @@ class PlayScene : SceneInterface { beat_ = music_.beat; if (beat_ >= context_.length) { + context_.destroy(); + music_.StopPlaying(); posteffect_.Initialize(); @@ -80,10 +82,6 @@ class PlayScene : SceneInterface { context_.DrawBackground(); context_.DrawElements(); context_.DrawActor(); - - if (beat_ >= context_.length) { - context_.destroy(); - } } private: