[fix] Fixed an issue that scenes were drawn even right after it's ended.
This commit is contained in:
parent
49408c0695
commit
05f4cfa351
@ -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_;
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -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:
|
||||
|
Reference in New Issue
Block a user