@@ -358,6 +358,7 @@ fn center_bar(
358358 width : Val :: Px ( 11.0 ) ,
359359 ..default ( )
360360 } ,
361+ PauseButton ,
361362 ) )
362363 . observe (
363364 |_trigger : Trigger < Pointer < Click > > , mut commands : Commands | {
@@ -367,6 +368,9 @@ fn center_bar(
367368 } ) ;
368369}
369370
371+ #[ derive( Component ) ]
372+ struct PauseButton ;
373+
370374fn left_bar (
371375 font_assets : & Res < FontAssets > ,
372376 texture_assets : & Res < TextureAssets > ,
@@ -845,10 +849,20 @@ struct TimerText;
845849fn update_game_time (
846850 mut game_timer : ResMut < GameTimer > ,
847851 time : Res < Time > ,
848- mut text : Single < & mut Text , With < TimerText > > ,
852+ text : Single < ( & mut Text , & mut Visibility ) , ( With < TimerText > , Without < PauseButton > ) > ,
853+ mut pause_button : Single < & mut Visibility , ( With < PauseButton > , Without < TimerText > ) > ,
854+ settings : Res < Settings > ,
849855) {
850856 game_timer. tick ( time. delta ( ) ) ;
857+ let ( mut text, mut visibility) = text. into_inner ( ) ;
851858 text. 0 = game_timer. to_string ( ) ;
859+ if settings. show_clock {
860+ * visibility = Visibility :: Visible ;
861+ * * pause_button = Visibility :: Visible ;
862+ } else {
863+ * visibility = Visibility :: Hidden ;
864+ * * pause_button = Visibility :: Hidden ;
865+ }
852866}
853867
854868#[ derive( Event ) ]
0 commit comments