[fix] Fixed an issue that posteffect's parameters were remained after music ended.

This commit is contained in:
falsycat 2019-10-16 00:00:00 +00:00
parent 673c2dfe94
commit 05377b7472
3 changed files with 12 additions and 2 deletions

View File

@ -60,6 +60,11 @@ class PostEffect {
fb_.Unbind();
}
///
void Initialize() {
instance = instance.init;
}
///
void BindFramebuffer() {
fb_.Bind();

View File

@ -48,7 +48,7 @@ class Game : AbstractGame {
title_ = new TitleScene(lobby_, programs_);
select_ = new SelectScene(lobby_, programs_, fonts_, music_list_);
load_ = new LoadingScene(lobby_, posteffect_, programs_, fonts_);
play_ = new PlayScene;
play_ = new PlayScene(posteffect_);
result_ = new ResultScene(lobby_, programs_, fonts_);
title_ .SetupSceneDependency(select_);

View File

@ -23,7 +23,8 @@ class PlayScene : SceneInterface {
enum NearnessScoreRatio = 10;
///
this() {
this(sjplayer.PostEffect posteffect) {
posteffect_ = posteffect;
}
~this() {
context_.destroy();
@ -42,12 +43,14 @@ class PlayScene : SceneInterface {
score_ = BaseScore;
music_.PlayForGame(offset_beat);
posteffect_.Initialize();
}
override SceneInterface Update(KeyInput input) {
beat_ = music_.beat;
if (beat_ >= context_.length) {
music_.StopPlaying();
posteffect_.Initialize();
result_scene_.Initialize(music_, score_);
return result_scene_;
@ -93,6 +96,8 @@ class PlayScene : SceneInterface {
return result;
}
sjplayer.PostEffect posteffect_;
ResultScene result_scene_;
Music music_;