aboutsummaryrefslogtreecommitdiffstats
path: root/src/base
diff options
context:
space:
mode:
Diffstat (limited to 'src/base')
-rw-r--r--src/base/UDraw.pas175
-rw-r--r--src/base/UGraphic.pas10
-rw-r--r--src/base/UNote.pas30
-rw-r--r--src/base/UThemes.pas80
4 files changed, 295 insertions, 0 deletions
diff --git a/src/base/UDraw.pas b/src/base/UDraw.pas
index 72e95f4b..6fe19ea8 100644
--- a/src/base/UDraw.pas
+++ b/src/base/UDraw.pas
@@ -53,6 +53,11 @@ procedure SingDrawTimeBar();
//Draw Editor NoteLines
procedure EditDrawLine(Left, Top, Right: real; NrLines: integer; Space: integer);
+// Draw Jukebox
+procedure SingDrawJukebox;
+procedure SingDrawJukeboxBackground;
+procedure SingDrawJukeboxTimeBar();
+
type
TRecR = record
Top: real;
@@ -93,6 +98,7 @@ uses
UMusic,
URecord,
UScreenSing,
+ UScreenJukebox,
USong,
UTexture;
@@ -171,6 +177,92 @@ begin
end;
end;
+procedure SingDrawJukeboxBackground;
+var
+ Rec: TRecR;
+ TexRec: TRecR;
+begin
+ if (ScreenJukebox.Tex_Background.TexNum > 0) then
+ begin
+ if (Ini.MovieSize <= 1) then //HalfSize BG
+ begin
+ (* half screen + gradient *)
+ Rec.Top := 110; // 80
+ Rec.Bottom := Rec.Top + 20;
+ Rec.Left := 0;
+ Rec.Right := 800;
+
+ TexRec.Top := (Rec.Top / 600) * ScreenJukebox.Tex_Background.TexH;
+ TexRec.Bottom := (Rec.Bottom / 600) * ScreenJukebox.Tex_Background.TexH;
+ TexRec.Left := 0;
+ TexRec.Right := ScreenJukebox.Tex_Background.TexW;
+
+ glEnable(GL_TEXTURE_2D);
+ glBindTexture(GL_TEXTURE_2D, ScreenJukebox.Tex_Background.TexNum);
+ glEnable(GL_BLEND);
+ glBegin(GL_QUADS);
+ (* gradient draw *)
+ (* top *)
+ glColor4f(1, 1, 1, 0);
+ glTexCoord2f(TexRec.Right, TexRec.Top); glVertex2f(Rec.Right, Rec.Top);
+ glTexCoord2f(TexRec.Left, TexRec.Top); glVertex2f(Rec.Left, Rec.Top);
+ glColor4f(1, 1, 1, 1);
+ glTexCoord2f(TexRec.Left, TexRec.Bottom); glVertex2f(Rec.Left, Rec.Bottom);
+ glTexCoord2f(TexRec.Right, TexRec.Bottom); glVertex2f(Rec.Right, Rec.Bottom);
+ (* mid *)
+ Rec.Top := Rec.Bottom;
+ Rec.Bottom := 490 - 20; // 490 - 20
+ TexRec.Top := TexRec.Bottom;
+ TexRec.Bottom := (Rec.Bottom / 600) * ScreenJukebox.Tex_Background.TexH;
+ glTexCoord2f(TexRec.Left, TexRec.Top); glVertex2f(Rec.Left, Rec.Top);
+ glTexCoord2f(TexRec.Left, TexRec.Bottom); glVertex2f(Rec.Left, Rec.Bottom);
+ glTexCoord2f(TexRec.Right, TexRec.Bottom); glVertex2f(Rec.Right, Rec.Bottom);
+ glTexCoord2f(TexRec.Right, TexRec.Top); glVertex2f(Rec.Right, Rec.Top);
+ (* bottom *)
+ Rec.Top := Rec.Bottom;
+ Rec.Bottom := 490; // 490
+ TexRec.Top := TexRec.Bottom;
+ TexRec.Bottom := (Rec.Bottom / 600) * ScreenJukebox.Tex_Background.TexH;
+ glTexCoord2f(TexRec.Right, TexRec.Top); glVertex2f(Rec.Right, Rec.Top);
+ glTexCoord2f(TexRec.Left, TexRec.Top); glVertex2f(Rec.Left, Rec.Top);
+ glColor4f(1, 1, 1, 0);
+ glTexCoord2f(TexRec.Left, TexRec.Bottom); glVertex2f(Rec.Left, Rec.Bottom);
+ glTexCoord2f(TexRec.Right, TexRec.Bottom); glVertex2f(Rec.Right, Rec.Bottom);
+
+ glEnd;
+ glDisable(GL_TEXTURE_2D);
+ glDisable(GL_BLEND);
+ end
+ else //Full Size BG
+ begin
+ glEnable(GL_TEXTURE_2D);
+ glBindTexture(GL_TEXTURE_2D, ScreenJukebox.Tex_Background.TexNum);
+ //glEnable(GL_BLEND);
+ glBegin(GL_QUADS);
+
+ glTexCoord2f(0, 0); glVertex2f(0, 0);
+ glTexCoord2f(0, ScreenJukebox.Tex_Background.TexH); glVertex2f(0, 600);
+ glTexCoord2f( ScreenJukebox.Tex_Background.TexW, ScreenJukebox.Tex_Background.TexH); glVertex2f(800, 600);
+ glTexCoord2f( ScreenJukebox.Tex_Background.TexW, 0); glVertex2f(800, 0);
+
+ glEnd;
+ glDisable(GL_TEXTURE_2D);
+ //glDisable(GL_BLEND);
+ end;
+ end
+ else
+ begin
+ // black screen
+ glColor4f(0, 0, 0, 1);
+ glbegin(gl_quads);
+ glVertex2f(0, 0);
+ glVertex2f(0, 600);
+ glVertex2f(800, 600);
+ glVertex2f(800, 0);
+ glEnd;
+ end;
+end;
+
procedure SingDrawOscilloscope(X, Y, W, H: real; NrSound: integer);
var
SampleIndex: integer;
@@ -901,6 +993,39 @@ begin
glDisable(GL_TEXTURE_2D);
end;
+procedure SingDrawJukebox;
+var
+ NR: TRecR; // lyrics area bounds (NR = NoteRec?)
+ LyricEngine: TLyricEngine;
+begin
+ // positions
+ if Ini.SingWindow = 0 then
+ NR.Left := 120
+ else
+ NR.Left := 20;
+
+ NR.Right := 780;
+
+ NR.Width := NR.Right - NR.Left;
+ NR.WMid := NR.Width / 2;
+ NR.Mid := NR.Left + NR.WMid;
+
+ // FIXME: accessing ScreenJukebox is not that generic
+ LyricEngine := ScreenJukebox.Lyrics;
+
+ // draw time-bar
+ if (ScreenAct = 1) and (ScreenJukebox.SongListVisible) then
+ SingDrawJukeboxTimeBar();
+
+ // draw Lyrics
+ if (ScreenJukebox.ShowLyrics) then
+ LyricEngine.Draw(LyricsState.MidBeat);
+ //SingDrawLyricHelper(NR.Left, NR.WMid);
+
+ glDisable(GL_BLEND);
+ glDisable(GL_TEXTURE_2D);
+end;
+
{//SingBar Mod
procedure SingDrawSingbar(X, Y, W, H: real; Percent: integer);
var
@@ -1171,5 +1296,55 @@ begin
glcolor4f(1, 1, 1, 1);
end;
+procedure SingDrawJukeboxTimeBar();
+var
+ x, y: real;
+ width, height: real;
+ LyricsProgress: real;
+ CurLyricsTime: real;
+begin
+ x := Theme.Jukebox.StaticTimeProgress.x;
+ y := Theme.Jukebox.StaticTimeProgress.y;
+
+ width := Theme.Jukebox.StaticTimeProgress.w;
+ height := Theme.Jukebox.StaticTimeProgress.h;
+
+ glColor4f(Theme.Jukebox.StaticTimeProgress.ColR,
+ Theme.Jukebox.StaticTimeProgress.ColG,
+ Theme.Jukebox.StaticTimeProgress.ColB, 1); //Set Color
+
+ glEnable(GL_TEXTURE_2D);
+ glEnable(GL_BLEND);
+ glBindTexture(GL_TEXTURE_2D, Tex_JukeboxTimeProgress.TexNum);
+
+ glBegin(GL_QUADS);
+ glTexCoord2f(0, 0);
+ glVertex2f(x, y);
+
+ CurLyricsTime := LyricsState.GetCurrentTime();
+ if (CurLyricsTime > 0) and
+ (LyricsState.TotalTime > 0) then
+ begin
+ LyricsProgress := CurLyricsTime / LyricsState.TotalTime;
+ // avoid that the bar "overflows" for inaccurate song lengths
+ if (LyricsProgress > 1.0) then
+ LyricsProgress := 1.0;
+ glTexCoord2f((width * LyricsProgress) / 8, 0);
+ glVertex2f(x + width * LyricsProgress, y);
+
+ glTexCoord2f((width * LyricsProgress) / 8, 1);
+ glVertex2f(x + width * LyricsProgress, y + height);
+ end;
+
+ glTexCoord2f(0, 1);
+ glVertex2f(x, y + height);
+ glEnd;
+
+ glDisable(GL_TEXTURE_2D);
+ glDisable(GL_BLEND);
+ glcolor4f(1, 1, 1, 1);
+
+end;
+
end.
diff --git a/src/base/UGraphic.pas b/src/base/UGraphic.pas
index 4f0c8c77..2c80b542 100644
--- a/src/base/UGraphic.pas
+++ b/src/base/UGraphic.pas
@@ -59,6 +59,7 @@ uses
UScreenSong,
UScreenSing,
UScreenScore,
+ UScreenJukeBox,
UScreenTop5,
UScreenEditSub,
UScreenEdit,
@@ -111,6 +112,7 @@ var
ScreenLevel: TScreenLevel;
ScreenSong: TScreenSong;
ScreenSing: TScreenSing;
+ ScreenJukebox: TScreenJukebox;
ScreenScore: TScreenScore;
ScreenTop5: TScreenTop5;
ScreenOptions: TScreenOptions;
@@ -173,6 +175,7 @@ var
FullScreen: boolean;
Tex_TimeProgress: TTexture;
+ Tex_JukeboxTimeProgress: TTexture;
//Sing Bar Mod
Tex_SingBar_Back: TTexture;
@@ -372,6 +375,10 @@ begin
//TimeBar mod
Tex_TimeProgress := Texture.LoadTexture(Skin.GetTextureFileName('TimeBar'));
//eoa TimeBar mod
+
+ //JukeBox mod
+ Tex_JukeboxTimeProgress := Texture.LoadTexture(Skin.GetTextureFileName('JukeboxTimeBar'));
+ //end Jukebox Mod
//SingBar Mod
Tex_SingBar_Back := Texture.LoadTexture(Skin.GetTextureFileName('SingBarBack'), TEXTURE_TYPE_PLAIN, 0);
@@ -741,6 +748,8 @@ begin
Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Song', 3); Log.BenchmarkStart(3);
ScreenSongMenu := TScreenSongMenu.Create;
Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Song Menu', 3); Log.BenchmarkStart(3);
+ ScreenJukebox := TScreenJukebox.Create;
+ Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Jukebox', 3); Log.BenchmarkStart(3);
ScreenSing := TScreenSing.Create;
Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Sing', 3); Log.BenchmarkStart(3);
ScreenScore := TScreenScore.Create;
@@ -819,6 +828,7 @@ begin
ScreenLevel.Free;
ScreenSong.Free;
ScreenSing.Free;
+ ScreenJukebox.Free;
ScreenScore.Free;
ScreenTop5.Free;
ScreenOptions.Free;
diff --git a/src/base/UNote.pas b/src/base/UNote.pas
index c82cc2e3..dc2c6922 100644
--- a/src/base/UNote.pas
+++ b/src/base/UNote.pas
@@ -44,6 +44,7 @@ uses
ULyrics,
URecord,
UScreenSing,
+ UScreenJukebox,
USong,
UTime;
@@ -135,6 +136,8 @@ procedure NewNote(Screen: TScreenSing); // detect note
function GetMidBeat(Time: real): real;
function GetTimeFromBeat(Beat: integer; SelfSong: TSong = nil): real;
+procedure SingJukebox(Screen: TScreenJukebox);
+
implementation
uses
@@ -325,6 +328,33 @@ begin
NewBeatDetect(Screen);
end;
+procedure SingJukebox(Screen: TScreenJukebox);
+var
+ Count: integer;
+ CountGr: integer;
+ CP: integer;
+begin
+ LyricsState.UpdateBeats();
+
+ // sentences routines
+ for CountGr := 0 to 0 do //High(Lines)
+ begin;
+ CP := CountGr;
+ // old parts
+ LyricsState.OldLine := Lines[CP].Current;
+
+ // choose current parts
+ for Count := 0 to Lines[CP].High do
+ begin
+ if LyricsState.CurrentBeat >= Lines[CP].Line[Count].Start then
+ Lines[CP].Current := Count;
+ end;
+ end; // for CountGr
+
+ // on sentence change...
+ Screen.onSentenceChange(Lines[0].Current);
+end;
+
procedure NewSentence(Screen: TScreenSing);
var
i: integer;
diff --git a/src/base/UThemes.pas b/src/base/UThemes.pas
index c90c7982..7bf4a4e5 100644
--- a/src/base/UThemes.pas
+++ b/src/base/UThemes.pas
@@ -107,9 +107,13 @@ type
W: integer;
Z: real;
Color: string;
+ DColor: string;
ColR: real;
ColG: real;
ColB: real;
+ DColR: real;
+ DColG: real;
+ DColB: real;
Font: integer;
Size: integer;
Align: integer;
@@ -370,11 +374,44 @@ type
PausePopUp: TThemeStatic;
end;
+ TThemeJukebox = class(TThemeBasic)
+ StaticTimeProgress: TThemeStatic;
+ StaticTimeBackground: TThemeStatic;
+ StaticSongBackground: TThemeStatic;
+ StaticSongListBackground: TThemeStatic;
+ TextTimeText: TThemeText;
+ TextTimeDesc: TThemeText;
+ TextSongText: TThemeText;
+ SongDescription: TThemeButton;
+ FindSong: TThemeButton;
+ RepeatSongList: TThemeButton;
+ SongListOrder: TThemeButton;
+ RandomSongList: TThemeButton;
+ Lyric: TThemeButton;
+ TextListText: TThemeText;
+ TextCountText: TThemeText;
+ SongCover: TThemeStatic;
+
+ //options desc
+ StaticOptions: TThemeStatic;
+ TextOptionsSongPosition: TThemeText;
+ TextOptionsLyric: TThemeText;
+ TextOptionsSort: TThemeText;
+ TextOptionsRandom: TThemeText;
+ TextOptionsRepeat: TThemeText;
+ TextOptionsFind: TThemeText;
+ end;
+
TThemeLyricBar = record
IndicatorYOffset, UpperX, UpperW, UpperY, UpperH,
LowerX, LowerW, LowerY, LowerH : integer;
end;
+ TThemeLyricBarJukebox = record
+ IndicatorYOffset, UpperX, UpperW, UpperY, UpperH,
+ LowerX, LowerW, LowerY, LowerH : integer;
+ end;
+
TThemeScore = class(TThemeBasic)
TextArtist: TThemeText;
TextTitle: TThemeText;
@@ -758,6 +795,8 @@ type
Song: TThemeSong;
Sing: TThemeSing;
LyricBar: TThemeLyricBar;
+ LyricBarJukebox: TThemeLyricBarJukebox;
+ Jukebox: TThemeJukebox;
Score: TThemeScore;
Top5: TThemeTop5;
Options: TThemeOptions;
@@ -1154,6 +1193,44 @@ begin
LyricBar.LowerY := ThemeIni.ReadInteger('SingLyricsLowerBar', 'Y', 0);
LyricBar.LowerH := ThemeIni.ReadInteger('SingLyricsLowerBar', 'H', 0);
+ // Lyric Jukebox
+ LyricBarJukebox.UpperX := ThemeIni.ReadInteger('JukeboxLyricsUpperBar', 'X', 0);
+ LyricBarJukebox.UpperW := ThemeIni.ReadInteger('JukeboxLyricsUpperBar', 'W', 0);
+ LyricBarJukebox.UpperY := ThemeIni.ReadInteger('JukeboxLyricsUpperBar', 'Y', 0);
+ LyricBarJukebox.UpperH := ThemeIni.ReadInteger('JukeboxLyricsUpperBar', 'H', 0);
+ LyricBarJukebox.LowerX := ThemeIni.ReadInteger('JukeboxLyricsLowerBar', 'X', 0);
+ LyricBarJukebox.LowerW := ThemeIni.ReadInteger('JukeboxLyricsLowerBar', 'W', 0);
+ LyricBarJukebox.LowerY := ThemeIni.ReadInteger('JukeboxLyricsLowerBar', 'Y', 0);
+ LyricBarJukebox.LowerH := ThemeIni.ReadInteger('JukeboxLyricsLowerBar', 'H', 0);
+ LyricBarJukebox.IndicatorYOffset := ThemeIni.ReadInteger('JukeboxLyricsUpperBar', 'IndicatorYOffset', 0);
+
+ // Jukebox
+ ThemeLoadStatic(Jukebox.StaticTimeProgress, 'JukeboxTimeProgress');
+ ThemeLoadStatic(Jukebox.StaticTimeBackground, 'JukeboxTimeBackground');
+ ThemeLoadStatic(Jukebox.StaticSongBackground, 'JukeboxSongBackground');
+ ThemeLoadStatic(Jukebox.StaticSongListBackground, 'JukeboxSongListBackground');
+ ThemeLoadText(Jukebox.TextTimeText, 'JukeboxTimeText');
+ ThemeLoadText(Jukebox.TextTimeDesc, 'JukeboxTimeDesc');
+ ThemeLoadText(Jukebox.TextSongText, 'JukeboxTextSong');
+ ThemeLoadButton(Jukebox.SongDescription, 'JukeboxSongDescription'); //TODO: BasisBit fish theme loading and fix theme for JukeBox
+ ThemeLoadButton(Jukebox.FindSong, 'JukeboxFind');
+ ThemeLoadButton(Jukebox.RepeatSongList, 'JukeboxRepeat');
+ ThemeLoadButton(Jukebox.SongListOrder, 'JukeboxSort');
+ ThemeLoadButton(Jukebox.RandomSongList, 'JukeboxRandom');
+ ThemeLoadButton(Jukebox.Lyric, 'JukeboxLyric');
+ ThemeLoadText(Jukebox.TextListText, 'JukeboxListText');
+ ThemeLoadText(Jukebox.TextCountText, 'JukeboxCountText');
+ ThemeLoadStatic(Jukebox.SongCover, 'JukeboxSongCover');
+
+ // options desc
+ ThemeLoadStatic(Jukebox.StaticOptions, 'JukeboxStaticOptions');
+ ThemeLoadText(Jukebox.TextOptionsSongPosition, 'JukeboxOptionsSongPositionDesc');
+ ThemeLoadText(Jukebox.TextOptionsLyric, 'JukeboxOptionsLyricDesc');
+ ThemeLoadText(Jukebox.TextOptionsRandom, 'JukeboxOptionsRandomDesc');
+ ThemeLoadText(Jukebox.TextOptionsRepeat, 'JukeboxOptionsRepeatDesc');
+ ThemeLoadText(Jukebox.TextOptionsFind, 'JukeboxOptionsFindDesc');
+ ThemeLoadText(Jukebox.TextOptionsSort, 'JukeboxOptionsSortDesc');
+
// Sing
ThemeLoadBasic(Sing, 'Sing');
//TimeBar mod
@@ -2447,6 +2524,9 @@ begin
freeandnil(Sing);
Sing := TThemeSing.Create;
+
+ freeandnil(Jukebox);
+ Jukebox := TThemeJukebox.Create;
freeandnil(Score);
Score := TThemeScore.Create;