aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authortobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-06-03 13:04:48 +0000
committertobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-06-03 13:04:48 +0000
commit649bc453f74b3af59c29ade469f5009a17b93995 (patch)
tree3d502e1daf70be64bb461976d2a1eb556bdddd61 /src
parent821733e30e78e05862ce73b0031d767099ef23cf (diff)
downloadusdx-649bc453f74b3af59c29ade469f5009a17b93995.tar.gz
usdx-649bc453f74b3af59c29ade469f5009a17b93995.tar.xz
usdx-649bc453f74b3af59c29ade469f5009a17b93995.zip
- cleanup (removed some commented unused code)
- added timebar display toggling with the 'T'-key to switch between current, remaining and total time in sing-screen git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2437 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'src')
-rw-r--r--src/screens/UScreenSing.pas120
1 files changed, 52 insertions, 68 deletions
diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas
index 233f1e38..67855e77 100644
--- a/src/screens/UScreenSing.pas
+++ b/src/screens/UScreenSing.pas
@@ -62,6 +62,12 @@ type
function GetClock(): real; override;
end;
+ TTimebarMode = (
+ tbmCurrent, // current song position
+ tbmRemaining, // remaining time
+ tbmTotal // total time
+ );
+
type
TScreenSing = class(TMenu)
private
@@ -70,6 +76,7 @@ type
fVideoClip: IVideo;
fLyricsSync: TLyricsSyncSource;
fMusicSync: TMusicSyncSource;
+ fTimebarMode: TTimebarMode;
protected
eSongLoaded: THookableEvent; //< event is called after lyrics of a song are loaded on OnShow
Paused: boolean; //pause Mod
@@ -178,7 +185,9 @@ begin
Result := false;
Exit;
end;
- Ord('V'): // show visualization
+
+ // show visualization
+ Ord('V'):
begin
fShowVisualization := not fShowVisualization;
@@ -193,11 +202,23 @@ begin
end;
Exit;
end;
+
+ // pause
Ord('P'):
begin
Pause;
Exit;
end;
+
+ // toggle time display
+ Ord('T'):
+ begin
+ if (fTimebarMode = High(TTimebarMode)) then
+ fTimebarMode := Low(TTimebarMode)
+ else
+ Inc(fTimebarMode);
+ Exit;
+ end;
end;
// check special keys
@@ -450,6 +471,8 @@ begin
Statics[StaticP3R].Visible := V3R;
Text[TextP3R].Visible := V3R;
+ fTimebarMode := tbmCurrent;
+
// FIXME: sets path and filename to ''
ResetSingTemp;
@@ -725,8 +748,10 @@ end;
function TScreenSing.Draw: boolean;
var
- Min: integer;
- Sec: integer;
+ DisplayTime: real;
+ DisplayPrefix: string;
+ DisplayMin: integer;
+ DisplaySec: integer;
T: integer;
CurLyricsTime: real;
VideoFrameTime: Extended;
@@ -769,53 +794,31 @@ begin
end; // case
end; // if
- ////
- // dual screen, part 1
- ////////////////////////
-
- // Note: ScreenX is the offset of the current screen in dual-screen mode so we
- // will move the statics and texts to the correct screen here.
- // FIXME: clean up this weird stuff. Commenting this stuff out, nothing
- // was missing on screen w/ 6 players - so do we even need this stuff?
- {Statics[StaticP1].Texture.X := Statics[StaticP1].Texture.X + 10 * ScreenX;
-
- Text[TextP1].X := Text[TextP1].X + 10 * ScreenX; }
-
- {Statics[StaticP1ScoreBG].Texture.X := Statics[StaticP1ScoreBG].Texture.X + 10*ScreenX;
- Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX;}
-
- {Statics[StaticP2R].Texture.X := Statics[StaticP2R].Texture.X + 10 * ScreenX;
-
- Text[TextP2R].X := Text[TextP2R].X + 10 * ScreenX; }
-
- {Statics[StaticP2RScoreBG].Texture.X := Statics[StaticP2RScoreBG].Texture.X + 10*ScreenX;
- Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX;}
-
- // end of weird stuff
- {
- Statics[1].Texture.X := Statics[1].Texture.X + 10 * ScreenX; }
-
- { for T := 0 to 1 do
- Text[T].X := Text[T].X + 10 * ScreenX; }
-
// retrieve current lyrics time, we have to store the value to avoid
// that min- and sec-values do not match
CurLyricsTime := LyricsState.GetCurrentTime();
- Min := Round(CurLyricsTime) div 60;
- Sec := Round(CurLyricsTime) mod 60;
+
+ // retrieve time for timebar text
+ case (fTimebarMode) of
+ tbmRemaining: begin
+ DisplayTime := LyricsState.TotalTime - CurLyricsTime;
+ DisplayPrefix := '-';
+ end;
+ tbmTotal: begin
+ DisplayTime := LyricsState.TotalTime;
+ DisplayPrefix := '#';
+ end;
+ else begin
+ DisplayTime := CurLyricsTime;
+ DisplayPrefix := '';
+ end;
+ end;
+ DisplayMin := Round(DisplayTime) div 60;
+ DisplaySec := Round(DisplayTime) mod 60;
// update static menu with time ...
- Text[TextTimeText].Text := '';
- if Min < 10 then
- Text[TextTimeText].Text := '0';
- Text[TextTimeText].Text := Text[TextTimeText].Text + IntToStr(Min) + ':';
- if Sec < 10 then
- Text[TextTimeText].Text := Text[TextTimeText].Text + '0';
- Text[TextTimeText].Text := Text[TextTimeText].Text + IntToStr(Sec);
-
- // draw static menu (BG)
- // Note: there is no menu and the animated background brakes the video playback
- //DrawBG;
+ Text[TextTimeText].Text := Format('%s%.2d:%.2d',
+ [DisplayPrefix, DisplayMin, DisplaySec]);
//the song was sung to the end?
Line := Lyrics.GetUpperLine();
@@ -857,8 +860,10 @@ begin
//Log.LogError('Check for music finish: ' + BoolToStr(Music.Finished) + ' ' + FloatToStr(LyricsState.CurrentTime*1000) + ' ' + IntToStr(CurrentSong.Finish));
if ShowFinish then
begin
- if (not AudioPlayback.Finished) and ((CurrentSong.Finish = 0) or
- (LyricsState.GetCurrentTime() * 1000 <= CurrentSong.Finish)) and (not Settings.Finish) then
+ if (not AudioPlayback.Finished) and
+ ((CurrentSong.Finish = 0) or
+ (LyricsState.GetCurrentTime() * 1000 <= CurrentSong.Finish)) and
+ (not Settings.Finish) then
begin
// analyze song if not paused
if (not Paused) then
@@ -886,27 +891,6 @@ begin
// draw scores
Scores.Draw;
- ////
- // dual screen, part 2
- ////////////////////////
-
- // Note: ScreenX is the offset of the current screen in dual-screen mode so we
- // will move the statics and texts to the correct screen here.
- // FIXME: clean up this weird stuff
-
- {Statics[StaticP1].Texture.X := Statics[StaticP1].Texture.X - 10 * ScreenX;
- Text[TextP1].X := Text[TextP1].X - 10 * ScreenX;
-
- Statics[StaticP2R].Texture.X := Statics[StaticP2R].Texture.X - 10 * ScreenX;
- Text[TextP2R].X := Text[TextP2R].X - 10 * ScreenX;
-
- // end of weird
-
- Statics[1].Texture.X := Statics[1].Texture.X - 10 * ScreenX;
-
- for T := 0 to 1 do
- Text[T].X := Text[T].X - 10 * ScreenX; }
-
// draw pausepopup
// FIXME: this is a workaround that the static is drawn over the lyrics, lines, scores and effects
// maybe someone could find a better solution