File tree 3 files changed +12
-0
lines changed
neothesia/src/scene/playing_scene
3 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -89,6 +89,10 @@ impl PlaybackState {
89
89
self . running = time;
90
90
}
91
91
92
+ pub fn is_finished ( & self ) -> bool {
93
+ self . time ( ) >= self . length ( )
94
+ }
95
+
92
96
pub fn percentage ( & self ) -> f32 {
93
97
self . running . as_secs_f32 ( ) / self . length ( ) . as_secs_f32 ( )
94
98
}
Original file line number Diff line number Diff line change @@ -166,6 +166,10 @@ impl MidiPlayer {
166
166
self . playback . percentage ( )
167
167
}
168
168
169
+ pub fn is_finished ( & self ) -> bool {
170
+ self . playback . is_finished ( )
171
+ }
172
+
169
173
pub fn time ( & self ) -> Duration {
170
174
self . playback . time ( )
171
175
}
Original file line number Diff line number Diff line change @@ -141,6 +141,10 @@ impl Scene for PlayingScene {
141
141
142
142
self . bg_quad_pipeline . prepare ( & ctx. gpu . queue ) ;
143
143
self . fg_quad_pipeline . prepare ( & ctx. gpu . queue ) ;
144
+
145
+ if self . player . is_finished ( ) {
146
+ ctx. proxy . send_event ( NeothesiaEvent :: MainMenu ) . ok ( ) ;
147
+ }
144
148
}
145
149
146
150
fn render < ' pass > (
You can’t perform that action at this time.
0 commit comments