From be68ff31e2d10d5f29894c6ec4ed877c70c142a3 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 6 Dec 2007 12:26:05 +0000 Subject: gave priority to videos over Visualization... so now video plays back... and "V" will switch between Video ( or jpg ) background and visualization. this needs to be pressed on every song, as the state should be forgotten. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@687 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSing.pas | 51 ++++++++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 17 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index e62b9339..75246d09 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -97,6 +97,9 @@ type //Score Manager: Scores: TSingScores; + fShowVisualization : boolean; + fCurrentVideoPlaybackEngine : IVideoPlayback; + constructor Create; override; procedure onShow; override; procedure onShowFinish; override; @@ -153,15 +156,22 @@ begin SDLK_V: //Show Visualization begin - AktSong.VideoLoaded := not AktSong.VideoLoaded; - VideoPlayback.play; + fShowVisualization := not fShowVisualization; + + if fShowVisualization then + fCurrentVideoPlaybackEngine := Visualization + else + fCurrentVideoPlaybackEngine := VideoPlayback; + + if fShowVisualization then + fCurrentVideoPlaybackEngine.play; end; SDLK_TAB: //Change Visualization Preset begin - if AktSong.VideoLoaded then - VideoPlayback.MoveTo( now ); // move to a random position + if fShowVisualization then + fCurrentVideoPlaybackEngine.MoveTo( now ); // move to a random position end; SDLK_RETURN: @@ -195,7 +205,7 @@ begin // pause Video if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then - VideoPlayback.Pause; + fCurrentVideoPlaybackEngine.Pause; end else //Pause ausschalten @@ -209,7 +219,7 @@ begin // Video if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then - VideoPlayback.Pause; + fCurrentVideoPlaybackEngine.Pause; Paused := false; end; @@ -223,6 +233,10 @@ var begin inherited Create; + fShowVisualization := false; + fCurrentVideoPlaybackEngine := VideoPlayback; + + //Create Score Class Scores := TSingScores.Create; Scores.LoadfromTheme; @@ -288,7 +302,7 @@ begin Lyrics := TLyricEngine.Create(80,Skin_LyricsT,640,12,80,Skin_LyricsT+36,640,12); - VideoPlayback.Init(); + fCurrentVideoPlaybackEngine.Init(); end; procedure TScreenSing.onShow; @@ -307,6 +321,9 @@ begin Log.LogStatus('Begin', 'onShow'); FadeOut := false; // 0.5.0: early 0.5.0 problems were by this line commented + // reset video playback engine, to play Video Clip... + fCurrentVideoPlaybackEngine := VideoPlayback; + //SetUp Score Manager Scores.ClearPlayers; //Clear Old Player Values Color.R := 0; Color.G := 0; Color.B := 0; //Dummy atm @@ -439,9 +456,9 @@ begin if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then begin // todo: VideoGap and Start time verwursten - VideoPlayback.Open( AktSong.Path + AktSong.Video ); + fCurrentVideoPlaybackEngine.Open( AktSong.Path + AktSong.Video ); - VideoPlayback.position := AktSong.VideoGAP + AktSong.Start; + fCurrentVideoPlaybackEngine.position := AktSong.VideoGAP + AktSong.Start; AktSong.VideoLoaded := true; end; @@ -857,10 +874,10 @@ begin begin try writeln( 'VideoPlayback.FFmpegGetFrame' ); - VideoPlayback.GetFrame(Czas.Teraz); + fCurrentVideoPlaybackEngine.GetFrame(Czas.Teraz); writeln( 'VideoPlayback.FFmpegDrawGL' ); - VideoPlayback.DrawGL(ScreenAct); + fCurrentVideoPlaybackEngine.DrawGL(ScreenAct); // PlaySmpeg; except @@ -874,7 +891,7 @@ begin Log.LogError('Corrupted File: ' + AktSong.Video); try // CloseSmpeg; - VideoPlayback.Close; + fCurrentVideoPlaybackEngine.Close; except end; @@ -1124,7 +1141,7 @@ begin SingDrawBackground; // update and draw movie - if ShowFinish and AktSong.VideoLoaded then + if ShowFinish and ( AktSong.VideoLoaded or fShowVisualization ) then // if ShowFinish then begin try @@ -1132,8 +1149,8 @@ begin // todo: find a way to determine, when a new frame is needed // toto: same for the need to skip frames - VideoPlayback.GetFrame(Czas.Teraz); - VideoPlayback.DrawGL(ScreenAct); + fCurrentVideoPlaybackEngine.GetFrame(Czas.Teraz); + fCurrentVideoPlaybackEngine.DrawGL(ScreenAct); except on E : Exception do begin @@ -1147,7 +1164,7 @@ begin Log.LogError('Corrupted File: ' + AktSong.Video); try // CloseSmpeg; - VideoPlayback.Close; + fCurrentVideoPlaybackEngine.Close; except end; @@ -1230,7 +1247,7 @@ begin if AktSong.VideoLoaded then begin // CloseSmpeg; - VideoPlayback.Close; + fCurrentVideoPlaybackEngine.Close; AktSong.VideoLoaded := false; // to prevent drawing closed video end; -- cgit v1.2.3