[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:
|
public:
|
||||||
///
|
///
|
||||||
this(SceneInterface first_scene) in (first_scene) {
|
this(SceneInterface first_scene) in (first_scene) {
|
||||||
next_scene_ = first_scene;
|
scene_ = first_scene;
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
void Update(KeyInput input) {
|
void Update(KeyInput input) {
|
||||||
scene_ = next_scene_;
|
while (true) {
|
||||||
next_scene_ = scene_.Update(input);
|
auto next_scene = scene_.Update(input);
|
||||||
|
if (next_scene is scene_) break;
|
||||||
|
|
||||||
|
scene_ = next_scene;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
///
|
///
|
||||||
void Draw() {
|
void Draw() {
|
||||||
@ -26,6 +30,4 @@ class AbstractGame {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
SceneInterface scene_;
|
SceneInterface scene_;
|
||||||
|
|
||||||
SceneInterface next_scene_;
|
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,6 @@ class LoadingScene : SceneInterface {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
override void Draw() {
|
override void Draw() {
|
||||||
if (anime_.isFinished) return;
|
|
||||||
lobby_.Draw();
|
lobby_.Draw();
|
||||||
loading_text_.Draw(lobby_.Projection, lobby_.view.Create());
|
loading_text_.Draw(lobby_.Projection, lobby_.view.Create());
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,8 @@ class PlayScene : SceneInterface {
|
|||||||
beat_ = music_.beat;
|
beat_ = music_.beat;
|
||||||
|
|
||||||
if (beat_ >= context_.length) {
|
if (beat_ >= context_.length) {
|
||||||
|
context_.destroy();
|
||||||
|
|
||||||
music_.StopPlaying();
|
music_.StopPlaying();
|
||||||
posteffect_.Initialize();
|
posteffect_.Initialize();
|
||||||
|
|
||||||
@ -80,10 +82,6 @@ class PlayScene : SceneInterface {
|
|||||||
context_.DrawBackground();
|
context_.DrawBackground();
|
||||||
context_.DrawElements();
|
context_.DrawElements();
|
||||||
context_.DrawActor();
|
context_.DrawActor();
|
||||||
|
|
||||||
if (beat_ >= context_.length) {
|
|
||||||
context_.destroy();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Reference in New Issue
Block a user