[fix] Fixed an issue that scenes were drawn even right after it's ended.

This commit is contained in:
falsycat 2019-10-18 00:00:00 +00:00
parent 49408c0695
commit 05f4cfa351
3 changed files with 9 additions and 10 deletions

View File

@ -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_;
}

View File

@ -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());
}

View File

@ -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: