From 6cdcfb402ce738dfc77b008fcb98fd1cda691eb5 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 19 Apr 2007 18:53:22 +0000 Subject: Added Statistic Screens to C0de and to Theme Moved some Translated Strings from UScreenPartyOptions to UTheme to use it with the Statistic Screens, too. Fixed use of /n Tag istead of the correct \n git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@118 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenStatMain.pas | 229 ++++++++++++++++++++++++++++++++++ 1 file changed, 229 insertions(+) create mode 100644 Game/Code/Screens/UScreenStatMain.pas (limited to 'Game/Code/Screens/UScreenStatMain.pas') diff --git a/Game/Code/Screens/UScreenStatMain.pas b/Game/Code/Screens/UScreenStatMain.pas new file mode 100644 index 00000000..337ed745 --- /dev/null +++ b/Game/Code/Screens/UScreenStatMain.pas @@ -0,0 +1,229 @@ +unit UScreenStatMain; + +interface + +uses + UMenu, SDL, SysUtils, UDisplay, UMusic, UIni, UThemes; + +type + TScreenStatMain = class(TMenu) + private + //Some Stat Value that don't need to be calculated 2 times + SongswithVid: Cardinal; + public + TextOverview: integer; + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure SetAnimationProgress(Progress: real); override; + + procedure SetOverview; + end; + +implementation + +uses UGraphic, UDataBase, USongs, ULanguage, windows, ULog; + +function TScreenStatMain.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + SDLK_Q: + begin + Result := false; + end; + SDLK_ESCAPE: + begin + Ini.Save; + Music.PlayBack; + FadeTo(@ScreenMain); + end; + SDLK_RETURN: + begin + //Exit Button Pressed + if Interaction = 4 then begin + Music.PlayBack; + FadeTo(@ScreenMain); + end + else //One of the Stats Buttons Pressed + begin + Music.PlayBack; + ScreenStatDetail.Typ := Interaction; + FadeTo(@ScreenStatDetail); + end; + end; + SDLK_LEFT: + begin + InteractPrev; + end; + SDLK_RIGHT: + begin + InteractNext; + end; + SDLK_UP: + begin + InteractPrev; + end; + SDLK_DOWN: + begin + InteractNext; + end; + end; + end; +end; + +constructor TScreenStatMain.Create; +var + I: integer; +begin + inherited Create; + + AddBackground(Theme.StatMain.Background.Tex); + + AddButton(Theme.StatMain.ButtonScores); + if (Length(Button[0].Text)=0) then + AddButtonText(14, 20, Theme.StatDetail.Description[0]); + + AddButton(Theme.StatMain.ButtonSingers); + if (Length(Button[1].Text)=0) then + AddButtonText(14, 20, Theme.StatDetail.Description[1]); + + AddButton(Theme.StatMain.ButtonSongs); + if (Length(Button[2].Text)=0) then + AddButtonText(14, 20, Theme.StatDetail.Description[2]); + + AddButton(Theme.StatMain.ButtonBands); + if (Length(Button[3].Text)=0) then + AddButtonText(14, 20, Theme.StatDetail.Description[3]); + + AddButton(Theme.StatMain.ButtonExit); + if (Length(Button[4].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[4]); + + TextOverview := AddText(Theme.StatMain.TextOverview); + + for I := 0 to High(Theme.StatMain.Static) do + AddStatic(Theme.StatMain.Static[I]); + + for I := 0 to High(Theme.StatMain.Text) do + AddText(Theme.StatMain.Text[I]); + + Interaction := 0; + + SongswithVid := 0; + For I := 0 to high(Songs.Song) do + if (Songs.Song[I].Video <> '') AND FileExists(Songs.Song[I].Path + Songs.Song[I].Video) then + Inc(SongswithVid); +end; + +procedure TScreenStatMain.onShow; +begin + //Set Overview Text: + SetOverview; +end; + +procedure TScreenStatMain.SetOverview; +var + Overview, Formatstr: String; + I: Integer; + //Some Vars to Save Attributes to + A1, A2, A3: Integer; + A4, A5: String; + Result1, Result2: AStatResult; + ResetTime: TSystemTime; + function GetFileCreation(Filename: String): TSystemTime; + var + FindData: TWin32FindData; + Handle: THandle; + begin + Handle := FindFirstFile(PChar(Filename), FindData); + if Handle <> INVALID_HANDLE_VALUE then + begin + FileTimeToSystemTime(FindData.ftCreationTime, Result); + Windows.FindClose(Handle); + end; + end; +begin + //Song Overview + + //Introduction + Formatstr := Language.Translate ('STAT_OVERVIEW_INTRO'); + {Format: + %0:d Ultrastar Version + %1:d Day of Reset (A1) + %2:d Month of Reset (A2) + %3:d Year of Reset (A3)} + + ResetTime := GetFileCreation(Database.Filename); + + A1 := ResetTime.wDay; + A2 := ResetTime.wMonth; + A3 := ResetTime.wYear; + try + Overview := Format(Formatstr, [Language.Translate('US_VERSION'), A1, A2, A3]); + except + on E: EConvertError do + Log.LogError('Error Parsing FormatString "STAT_OVERVIEW_INTRO": ' + E.Message); + end; + + Formatstr := Language.Translate ('STAT_OVERVIEW_SONG'); + {Format: + %0:d Count Songs (A1) + %1:d Count of Sung Songs (A2) + %2:d Count of UnSung Songs + %3:d Count of Songs with Video (A3) + %4:s Name of the most popular Song} + A1 := Length(CatSongs.Song); + A2 := Database.GetTotalEntrys(2); + + A3 := SongswithVid; + + SetLength(Result1, 1); + Database.GetStats(Result1, 2, 1, 0, False); + A4 := Result1[0].Artist; + A5 := Result1[0].Title; + + try + Overview := Overview + '\n \n' + Format(Formatstr, [A1, A2, A1-A2, A3, A4, A5]); + except + on E: EConvertError do + Log.LogError('Error Parsing FormatString "STAT_OVERVIEW_SONG": ' + E.Message); + end; + + //Player Overview + Formatstr := Language.Translate ('STAT_OVERVIEW_PLAYER'); + {Format: + %0:d Count Players (A1) + %1:s Best Player (Result) + %2:d Best Players Score + %3:s Best Score Player (Result2) + %4:d Best Score} + A1 := Database.GetTotalEntrys(1); + + SetLength(Result1, 1); + Database.GetStats(Result1, 1, 1, 0, False); + + SetLength(Result2, 1); + Database.GetStats(Result2, 0, 1, 0, False); + + try + Overview := Overview + '\n \n' + Format(Formatstr, [A1, Result1[0].Player, Result1[0].AverageScore, Result2[0].Singer, Result2[0].Score]); + except + on E: EConvertError do + Log.LogError('Error Parsing FormatString "STAT_OVERVIEW_PLAYER": ' + E.Message); + end; + + Text[0].Text := Overview; +end; + + +procedure TScreenStatMain.SetAnimationProgress(Progress: real); +var I: Integer; +begin + For I := 0 to high(Button) do + Button[I].Texture.ScaleW := Progress; +end; + +end. \ No newline at end of file -- cgit v1.2.3 From bda4fa8e57ca63a1d591433f120b4226d6a5d327 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 29 Apr 2007 17:50:29 +0000 Subject: Added 2 new Buttons to ScreenMain: Multi and Stats Updated Language Fiels to Fit with new Buttons Some CodeClean Up in Menu Class and in Screens Some minor Bug fixes I forgot about Added ability to group Buttons within a Screen New Theme Object: ButtonCollection: Same Attributes as a Button Plus FirstChild: Defining the First Button in the Group. For Example: SingSolo is 1, SingMulti Button is 2, in ScreenMain Added Attribute to Theme Button: Parent: Number of the assigned Group, 0 for no Group Used new Abilitys in MainScreen git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@149 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenStatMain.pas | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'Game/Code/Screens/UScreenStatMain.pas') diff --git a/Game/Code/Screens/UScreenStatMain.pas b/Game/Code/Screens/UScreenStatMain.pas index 337ed745..219ccd57 100644 --- a/Game/Code/Screens/UScreenStatMain.pas +++ b/Game/Code/Screens/UScreenStatMain.pas @@ -80,7 +80,9 @@ var begin inherited Create; - AddBackground(Theme.StatMain.Background.Tex); + TextOverview := AddText(Theme.StatMain.TextOverview); + + LoadFromTheme(Theme.StatMain); AddButton(Theme.StatMain.ButtonScores); if (Length(Button[0].Text)=0) then @@ -102,16 +104,9 @@ begin if (Length(Button[4].Text)=0) then AddButtonText(14, 20, Theme.Options.Description[4]); - TextOverview := AddText(Theme.StatMain.TextOverview); - - for I := 0 to High(Theme.StatMain.Static) do - AddStatic(Theme.StatMain.Static[I]); - - for I := 0 to High(Theme.StatMain.Text) do - AddText(Theme.StatMain.Text[I]); - Interaction := 0; + //Set Songs with Vid SongswithVid := 0; For I := 0 to high(Songs.Song) do if (Songs.Song[I].Video <> '') AND FileExists(Songs.Song[I].Path + Songs.Song[I].Video) then -- cgit v1.2.3 From 1858dadeadf071bbc3eb16ae835fc9bd95440eab Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 17 May 2007 14:23:38 +0000 Subject: Video Tag will now only be read when the VideoFile exists. -> Better usability of VideoIcon git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@214 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenStatMain.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Game/Code/Screens/UScreenStatMain.pas') diff --git a/Game/Code/Screens/UScreenStatMain.pas b/Game/Code/Screens/UScreenStatMain.pas index 219ccd57..54457a6e 100644 --- a/Game/Code/Screens/UScreenStatMain.pas +++ b/Game/Code/Screens/UScreenStatMain.pas @@ -109,7 +109,7 @@ begin //Set Songs with Vid SongswithVid := 0; For I := 0 to high(Songs.Song) do - if (Songs.Song[I].Video <> '') AND FileExists(Songs.Song[I].Path + Songs.Song[I].Video) then + if (Songs.Song[I].Video <> '') then Inc(SongswithVid); end; -- cgit v1.2.3 From a1612bc4ad4ebbfe166ce8006012b6cac4c0abf3 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Mon, 9 Jul 2007 16:42:38 +0000 Subject: Fixed Bug in Stat Main: Categorys was counted as Songs git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@283 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenStatMain.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Game/Code/Screens/UScreenStatMain.pas') diff --git a/Game/Code/Screens/UScreenStatMain.pas b/Game/Code/Screens/UScreenStatMain.pas index 54457a6e..b3907d41 100644 --- a/Game/Code/Screens/UScreenStatMain.pas +++ b/Game/Code/Screens/UScreenStatMain.pas @@ -170,7 +170,7 @@ begin %2:d Count of UnSung Songs %3:d Count of Songs with Video (A3) %4:s Name of the most popular Song} - A1 := Length(CatSongs.Song); + A1 := Length(Songs.Song); A2 := Database.GetTotalEntrys(2); A3 := SongswithVid; -- cgit v1.2.3 From 3043d3db91c3a541881aa951bbd4f8ccb5e3ce40 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Wed, 5 Sep 2007 12:35:19 +0000 Subject: modified ParseInput so Backspace will perform same function as ESC in most screens ( Except where text input is required, and backspace is used for text input ) This has been done, so that when used with Windows Media Center IR Remotes ( needs SDL 1.2 dll at runtime ) users can navigate throug the game without sitting in front of the PC keyboard. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@370 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenStatMain.pas | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Game/Code/Screens/UScreenStatMain.pas') diff --git a/Game/Code/Screens/UScreenStatMain.pas b/Game/Code/Screens/UScreenStatMain.pas index b3907d41..86d7d561 100644 --- a/Game/Code/Screens/UScreenStatMain.pas +++ b/Game/Code/Screens/UScreenStatMain.pas @@ -34,7 +34,9 @@ begin begin Result := false; end; - SDLK_ESCAPE: + + SDLK_ESCAPE, + SDLK_BACKSPACE : begin Ini.Save; Music.PlayBack; -- cgit v1.2.3 From 433a1b7339e2bf96f3b0bb4c98b8c799c6540027 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Tue, 18 Sep 2007 13:19:20 +0000 Subject: changes in order to compile in lazarus... minor tidy ups and removal of big old comment blocks.. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@394 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenStatMain.pas | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'Game/Code/Screens/UScreenStatMain.pas') diff --git a/Game/Code/Screens/UScreenStatMain.pas b/Game/Code/Screens/UScreenStatMain.pas index 86d7d561..f7961727 100644 --- a/Game/Code/Screens/UScreenStatMain.pas +++ b/Game/Code/Screens/UScreenStatMain.pas @@ -2,6 +2,11 @@ unit UScreenStatMain; interface +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + + uses UMenu, SDL, SysUtils, UDisplay, UMusic, UIni, UThemes; @@ -223,4 +228,4 @@ begin Button[I].Texture.ScaleW := Progress; end; -end. \ No newline at end of file +end. -- cgit v1.2.3 From db82b7e30a1b58b56fdb4bfc6089b47200ca1da1 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 20 Sep 2007 06:36:58 +0000 Subject: Ultrastar-DX now compiles in linux (using lazarus) Bass etc is commented out.. but it compiles, and im working through the runtime errors. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@408 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenStatMain.pas | 516 +++++++++++++++++++--------------- 1 file changed, 285 insertions(+), 231 deletions(-) (limited to 'Game/Code/Screens/UScreenStatMain.pas') diff --git a/Game/Code/Screens/UScreenStatMain.pas b/Game/Code/Screens/UScreenStatMain.pas index f7961727..223ad2b2 100644 --- a/Game/Code/Screens/UScreenStatMain.pas +++ b/Game/Code/Screens/UScreenStatMain.pas @@ -1,231 +1,285 @@ -unit UScreenStatMain; - -interface - -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - - -uses - UMenu, SDL, SysUtils, UDisplay, UMusic, UIni, UThemes; - -type - TScreenStatMain = class(TMenu) - private - //Some Stat Value that don't need to be calculated 2 times - SongswithVid: Cardinal; - public - TextOverview: integer; - constructor Create; override; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; - procedure onShow; override; - procedure SetAnimationProgress(Progress: real); override; - - procedure SetOverview; - end; - -implementation - -uses UGraphic, UDataBase, USongs, ULanguage, windows, ULog; - -function TScreenStatMain.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; -begin - Result := true; - If (PressedDown) Then - begin // Key Down - case PressedKey of - SDLK_Q: - begin - Result := false; - end; - - SDLK_ESCAPE, - SDLK_BACKSPACE : - begin - Ini.Save; - Music.PlayBack; - FadeTo(@ScreenMain); - end; - SDLK_RETURN: - begin - //Exit Button Pressed - if Interaction = 4 then begin - Music.PlayBack; - FadeTo(@ScreenMain); - end - else //One of the Stats Buttons Pressed - begin - Music.PlayBack; - ScreenStatDetail.Typ := Interaction; - FadeTo(@ScreenStatDetail); - end; - end; - SDLK_LEFT: - begin - InteractPrev; - end; - SDLK_RIGHT: - begin - InteractNext; - end; - SDLK_UP: - begin - InteractPrev; - end; - SDLK_DOWN: - begin - InteractNext; - end; - end; - end; -end; - -constructor TScreenStatMain.Create; -var - I: integer; -begin - inherited Create; - - TextOverview := AddText(Theme.StatMain.TextOverview); - - LoadFromTheme(Theme.StatMain); - - AddButton(Theme.StatMain.ButtonScores); - if (Length(Button[0].Text)=0) then - AddButtonText(14, 20, Theme.StatDetail.Description[0]); - - AddButton(Theme.StatMain.ButtonSingers); - if (Length(Button[1].Text)=0) then - AddButtonText(14, 20, Theme.StatDetail.Description[1]); - - AddButton(Theme.StatMain.ButtonSongs); - if (Length(Button[2].Text)=0) then - AddButtonText(14, 20, Theme.StatDetail.Description[2]); - - AddButton(Theme.StatMain.ButtonBands); - if (Length(Button[3].Text)=0) then - AddButtonText(14, 20, Theme.StatDetail.Description[3]); - - AddButton(Theme.StatMain.ButtonExit); - if (Length(Button[4].Text)=0) then - AddButtonText(14, 20, Theme.Options.Description[4]); - - Interaction := 0; - - //Set Songs with Vid - SongswithVid := 0; - For I := 0 to high(Songs.Song) do - if (Songs.Song[I].Video <> '') then - Inc(SongswithVid); -end; - -procedure TScreenStatMain.onShow; -begin - //Set Overview Text: - SetOverview; -end; - -procedure TScreenStatMain.SetOverview; -var - Overview, Formatstr: String; - I: Integer; - //Some Vars to Save Attributes to - A1, A2, A3: Integer; - A4, A5: String; - Result1, Result2: AStatResult; - ResetTime: TSystemTime; - function GetFileCreation(Filename: String): TSystemTime; - var - FindData: TWin32FindData; - Handle: THandle; - begin - Handle := FindFirstFile(PChar(Filename), FindData); - if Handle <> INVALID_HANDLE_VALUE then - begin - FileTimeToSystemTime(FindData.ftCreationTime, Result); - Windows.FindClose(Handle); - end; - end; -begin - //Song Overview - - //Introduction - Formatstr := Language.Translate ('STAT_OVERVIEW_INTRO'); - {Format: - %0:d Ultrastar Version - %1:d Day of Reset (A1) - %2:d Month of Reset (A2) - %3:d Year of Reset (A3)} - - ResetTime := GetFileCreation(Database.Filename); - - A1 := ResetTime.wDay; - A2 := ResetTime.wMonth; - A3 := ResetTime.wYear; - try - Overview := Format(Formatstr, [Language.Translate('US_VERSION'), A1, A2, A3]); - except - on E: EConvertError do - Log.LogError('Error Parsing FormatString "STAT_OVERVIEW_INTRO": ' + E.Message); - end; - - Formatstr := Language.Translate ('STAT_OVERVIEW_SONG'); - {Format: - %0:d Count Songs (A1) - %1:d Count of Sung Songs (A2) - %2:d Count of UnSung Songs - %3:d Count of Songs with Video (A3) - %4:s Name of the most popular Song} - A1 := Length(Songs.Song); - A2 := Database.GetTotalEntrys(2); - - A3 := SongswithVid; - - SetLength(Result1, 1); - Database.GetStats(Result1, 2, 1, 0, False); - A4 := Result1[0].Artist; - A5 := Result1[0].Title; - - try - Overview := Overview + '\n \n' + Format(Formatstr, [A1, A2, A1-A2, A3, A4, A5]); - except - on E: EConvertError do - Log.LogError('Error Parsing FormatString "STAT_OVERVIEW_SONG": ' + E.Message); - end; - - //Player Overview - Formatstr := Language.Translate ('STAT_OVERVIEW_PLAYER'); - {Format: - %0:d Count Players (A1) - %1:s Best Player (Result) - %2:d Best Players Score - %3:s Best Score Player (Result2) - %4:d Best Score} - A1 := Database.GetTotalEntrys(1); - - SetLength(Result1, 1); - Database.GetStats(Result1, 1, 1, 0, False); - - SetLength(Result2, 1); - Database.GetStats(Result2, 0, 1, 0, False); - - try - Overview := Overview + '\n \n' + Format(Formatstr, [A1, Result1[0].Player, Result1[0].AverageScore, Result2[0].Singer, Result2[0].Score]); - except - on E: EConvertError do - Log.LogError('Error Parsing FormatString "STAT_OVERVIEW_PLAYER": ' + E.Message); - end; - - Text[0].Text := Overview; -end; - - -procedure TScreenStatMain.SetAnimationProgress(Progress: real); -var I: Integer; -begin - For I := 0 to high(Button) do - Button[I].Texture.ScaleW := Progress; -end; - -end. +unit UScreenStatMain; + +interface + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + + +uses + UMenu, + SDL, + SysUtils, + UDisplay, + UMusic, + UIni, + UThemes; + +type + TScreenStatMain = class(TMenu) + private + //Some Stat Value that don't need to be calculated 2 times + SongswithVid: Cardinal; + public + TextOverview: integer; + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure SetAnimationProgress(Progress: real); override; + + procedure SetOverview; + end; + +implementation + +uses UGraphic, + UDataBase, + USongs, + ULanguage, + UCommon, + {$IFDEF win32} + windows, + {$ELSE} + sysconst, + {$ENDIF} + ULog; + +function TScreenStatMain.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + SDLK_Q: + begin + Result := false; + end; + + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + Ini.Save; + Music.PlayBack; + FadeTo(@ScreenMain); + end; + SDLK_RETURN: + begin + //Exit Button Pressed + if Interaction = 4 then begin + Music.PlayBack; + FadeTo(@ScreenMain); + end + else //One of the Stats Buttons Pressed + begin + Music.PlayBack; + ScreenStatDetail.Typ := Interaction; + FadeTo(@ScreenStatDetail); + end; + end; + SDLK_LEFT: + begin + InteractPrev; + end; + SDLK_RIGHT: + begin + InteractNext; + end; + SDLK_UP: + begin + InteractPrev; + end; + SDLK_DOWN: + begin + InteractNext; + end; + end; + end; +end; + +constructor TScreenStatMain.Create; +var + I: integer; +begin + inherited Create; + + TextOverview := AddText(Theme.StatMain.TextOverview); + + LoadFromTheme(Theme.StatMain); + + AddButton(Theme.StatMain.ButtonScores); + if (Length(Button[0].Text)=0) then + AddButtonText(14, 20, Theme.StatDetail.Description[0]); + + AddButton(Theme.StatMain.ButtonSingers); + if (Length(Button[1].Text)=0) then + AddButtonText(14, 20, Theme.StatDetail.Description[1]); + + AddButton(Theme.StatMain.ButtonSongs); + if (Length(Button[2].Text)=0) then + AddButtonText(14, 20, Theme.StatDetail.Description[2]); + + AddButton(Theme.StatMain.ButtonBands); + if (Length(Button[3].Text)=0) then + AddButtonText(14, 20, Theme.StatDetail.Description[3]); + + AddButton(Theme.StatMain.ButtonExit); + if (Length(Button[4].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[4]); + + Interaction := 0; + + //Set Songs with Vid + SongswithVid := 0; + For I := 0 to high(Songs.Song) do + if (Songs.Song[I].Video <> '') then + Inc(SongswithVid); +end; + +procedure TScreenStatMain.onShow; +begin + //Set Overview Text: + SetOverview; +end; + +procedure TScreenStatMain.SetOverview; +type + TwSystemTime = record + wYear, + wMonth, + wDayOfWeek, + wDay, + wHour, + wMinute, + wSecond, + wMilliseconds: Word; + end; +var + Overview, Formatstr: String; + I: Integer; + //Some Vars to Save Attributes to + A1, A2, A3: Integer; + A4, A5: String; + Result1, Result2: AStatResult; + ResetTime: TSystemTime; + + {$IFDEF win32} + function GetFileCreation(Filename: String): TSystemTime; + var + FindData: TWin32FindData; + Handle: THandle; + begin + Handle := FindFirstFile(PChar(Filename), FindData); + if Handle <> INVALID_HANDLE_VALUE then + begin + FileTimeToSystemTime(FindData.ftCreationTime, Result); + windows.FindClose(Handle); + end; + end; + + {$ELSE} + + function GetFileCreation(Filename: String): TSystemTime; + Var + F,D : Longint; + Begin + F:=FileCreate( Filename ); + try + D:=FileGetDate(F); + DateTimeToSystemTime( FileDateToDateTime(D) , result); + finally + FileClose(F); + end; + end; + {$ENDIF} + +begin + //Song Overview + + //Introduction + Formatstr := Language.Translate ('STAT_OVERVIEW_INTRO'); + (*Format: + %0:d Ultrastar Version + %1:d Day of Reset (A1) + %2:d Month of Reset (A2) + %3:d Year of Reset (A3)*) + + ResetTime := GetFileCreation(Database.Filename); + + {$IFDEF win32} + A1 := ResetTime.wDay; + A2 := ResetTime.wMonth; + A3 := ResetTime.wYear; + {$ELSE} + A1 := ResetTime.Day; + A2 := ResetTime.Month; + A3 := ResetTime.Year; + {$ENDIF} + + + try + Overview := Format(Formatstr, [Language.Translate('US_VERSION'), A1, A2, A3]); + except + on E: EConvertError do + Log.LogError('Error Parsing FormatString "STAT_OVERVIEW_INTRO": ' + E.Message); + end; + + Formatstr := Language.Translate ('STAT_OVERVIEW_SONG'); + {Format: + %0:d Count Songs (A1) + %1:d Count of Sung Songs (A2) + %2:d Count of UnSung Songs + %3:d Count of Songs with Video (A3) + %4:s Name of the most popular Song} + A1 := Length(Songs.Song); + A2 := Database.GetTotalEntrys(2); + + A3 := SongswithVid; + + SetLength(Result1, 1); + Database.GetStats(Result1, 2, 1, 0, False); + A4 := Result1[0].Artist; + A5 := Result1[0].Title; + + try + Overview := Overview + '\n \n' + Format(Formatstr, [A1, A2, A1-A2, A3, A4, A5]); + except + on E: EConvertError do + Log.LogError('Error Parsing FormatString "STAT_OVERVIEW_SONG": ' + E.Message); + end; + + //Player Overview + Formatstr := Language.Translate ('STAT_OVERVIEW_PLAYER'); + {Format: + %0:d Count Players (A1) + %1:s Best Player (Result) + %2:d Best Players Score + %3:s Best Score Player (Result2) + %4:d Best Score} + A1 := Database.GetTotalEntrys(1); + + SetLength(Result1, 1); + Database.GetStats(Result1, 1, 1, 0, False); + + SetLength(Result2, 1); + Database.GetStats(Result2, 0, 1, 0, False); + + try + Overview := Overview + '\n \n' + Format(Formatstr, [A1, Result1[0].Player, Result1[0].AverageScore, Result2[0].Singer, Result2[0].Score]); + except + on E: EConvertError do + Log.LogError('Error Parsing FormatString "STAT_OVERVIEW_PLAYER": ' + E.Message); + end; + + Text[0].Text := Overview; +end; + + +procedure TScreenStatMain.SetAnimationProgress(Progress: real); +var I: Integer; +begin + For I := 0 to high(Button) do + Button[I].Texture.ScaleW := Progress; +end; + +end. -- cgit v1.2.3 From 44554c7908f7e2405a249331f00a35703f5939c2 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 11 Oct 2007 12:02:20 +0000 Subject: Added IAudioPlayback Interface and implementation for BASS. Created "AudioPlayback" Global Singleton, which removed the need for the "Music" Global variable. This was done because global singleton objects are a recognized better "design pattern" achieving the same thing as global variables, but in a nicer way. I will be working to a) separate IAudioPlayback in to separate "Playback" and "Input" Interfaces b) build a FFMpeg class that implements IAudioPlayback git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@504 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenStatMain.pas | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'Game/Code/Screens/UScreenStatMain.pas') diff --git a/Game/Code/Screens/UScreenStatMain.pas b/Game/Code/Screens/UScreenStatMain.pas index 223ad2b2..4f46bec2 100644 --- a/Game/Code/Screens/UScreenStatMain.pas +++ b/Game/Code/Screens/UScreenStatMain.pas @@ -60,19 +60,20 @@ begin SDLK_BACKSPACE : begin Ini.Save; - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(@ScreenMain); end; SDLK_RETURN: begin //Exit Button Pressed - if Interaction = 4 then begin - Music.PlayBack; + if Interaction = 4 then + begin + AudioPlayback.PlayBack; FadeTo(@ScreenMain); end else //One of the Stats Buttons Pressed begin - Music.PlayBack; + AudioPlayback.PlayBack; ScreenStatDetail.Typ := Interaction; FadeTo(@ScreenStatDetail); end; -- cgit v1.2.3 From 391d30716d48dc709f6444b19c008e82311623b9 Mon Sep 17 00:00:00 2001 From: eddie-0815 Date: Thu, 1 Nov 2007 19:34:40 +0000 Subject: Mac OS X version compiles and links. I hope I didn't break too many files on windows/linux. Added switches.inc to all files. Changed many IFDEFs. For Windows-only code please use MSWINDOWS instead of WIN32 now. WIN32 is also used by the Mac port. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@546 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenStatMain.pas | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'Game/Code/Screens/UScreenStatMain.pas') diff --git a/Game/Code/Screens/UScreenStatMain.pas b/Game/Code/Screens/UScreenStatMain.pas index 4f46bec2..02209dd7 100644 --- a/Game/Code/Screens/UScreenStatMain.pas +++ b/Game/Code/Screens/UScreenStatMain.pas @@ -2,10 +2,7 @@ unit UScreenStatMain; interface -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - +{$I switches.inc} uses UMenu, @@ -164,7 +161,7 @@ var Result1, Result2: AStatResult; ResetTime: TSystemTime; - {$IFDEF win32} + {$IFDEF MSWINDOWS} function GetFileCreation(Filename: String): TSystemTime; var FindData: TWin32FindData; @@ -207,7 +204,7 @@ begin ResetTime := GetFileCreation(Database.Filename); - {$IFDEF win32} + {$IFDEF MSWINDOWS} A1 := ResetTime.wDay; A2 := ResetTime.wMonth; A3 := ResetTime.wYear; -- cgit v1.2.3 From 99955c78f63d1cb0d8bec666bc33953590a74c8a Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 1 Nov 2007 23:22:01 +0000 Subject: fixed failed builds build:USDX-LAZLIN-75 build:USDX-LAZLIN-76 for some reason we can not use {$MODE Delphi} in an included file. ( Probably because of the way the compier scopes this switch to each pas file ) ive had to revert this part of eddies changes. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@548 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenStatMain.pas | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Game/Code/Screens/UScreenStatMain.pas') diff --git a/Game/Code/Screens/UScreenStatMain.pas b/Game/Code/Screens/UScreenStatMain.pas index 02209dd7..7e5c7d91 100644 --- a/Game/Code/Screens/UScreenStatMain.pas +++ b/Game/Code/Screens/UScreenStatMain.pas @@ -2,6 +2,10 @@ unit UScreenStatMain; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} uses -- cgit v1.2.3 From e74bd57c12f470257111c1c0530fb38f0fd34414 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Sat, 12 Jan 2008 12:31:43 +0000 Subject: bunch of smaller changes... some changes to song loading... Record global changed to singleton object started implementing mic volume display in Settings-Record hope this dosnt break anything.. :P git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@789 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenStatMain.pas | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'Game/Code/Screens/UScreenStatMain.pas') diff --git a/Game/Code/Screens/UScreenStatMain.pas b/Game/Code/Screens/UScreenStatMain.pas index 7e5c7d91..f7257201 100644 --- a/Game/Code/Screens/UScreenStatMain.pas +++ b/Game/Code/Screens/UScreenStatMain.pas @@ -37,6 +37,7 @@ implementation uses UGraphic, UDataBase, USongs, + USong, ULanguage, UCommon, {$IFDEF win32} @@ -133,8 +134,8 @@ begin //Set Songs with Vid SongswithVid := 0; - For I := 0 to high(Songs.Song) do - if (Songs.Song[I].Video <> '') then + For I := 0 to Songs.SongList.Count -1 do + if (TSong(Songs.SongList[I]).Video <> '') then Inc(SongswithVid); end; @@ -233,7 +234,7 @@ begin %2:d Count of UnSung Songs %3:d Count of Songs with Video (A3) %4:s Name of the most popular Song} - A1 := Length(Songs.Song); + A1 := Songs.SongList.Count; A2 := Database.GetTotalEntrys(2); A3 := SongswithVid; -- cgit v1.2.3 From dee94f5dae9e6b5ae6c7b54a12a567745abc8dc3 Mon Sep 17 00:00:00 2001 From: tobigun Date: Tue, 5 Feb 2008 20:36:19 +0000 Subject: General: - cleanup and adaption of SingDrawOscilloscope Portaudio/SDL audio output: - stuttering in portaudio output has been fixed (SDL_MixBuffers cannot be used without initializing the SDL audio stuff first, so it is not usable with portaudio. Now SDL is used for audio-output instead of portaudio (although the file-name is UAudioPlayback_Portaudio.pas at the moment). - cleaner file closing - volume adjustment UMusic: - cleanup of the audio-interfaces - introduced TNoteType = (ntFreestyle, ntNormal, ntGolden) - some bug-fixes - introduced TSoundLibrary. This is library for all in-game sounds used by USDX. Instead of calling AudioPlayer.PlaySwoosh you should call AudioPlayer.PlaySound(SoundLib.Swoosh) now. You might call SoundLib.Swoosh.Play too, but this is not recommended at the moment because SoundLib.Swoosh could be nil if the file was not found. The SoundLibrary approach is much cleaner than the previous one. The AudioPlayer does not have to specify a Play... and Stop... method for every available sound anymore. In addition it is not an AudioPlayers responsibility to init the in-game sounds. URecord: - polish to english translation of some variables - CaptureSoundLeft/Right is CaptureChannel[0/1] now - TSoundCardInput -> TAudioInputDeviceSource - TGenericSoundCard.Input -> TGenericSoundCard.Source - autocorrelation algorithm more readable now - Clean-up of the audio-input interface - moved cloned code of the input-classes to one base class (TAudioInputBase) - Cleaner finalization - Start-/StopCapture will not crash anymore in the recording-options menu - Fixed several bugs in the autocorrelation stuff (e.g. wrong usage of $10000) - SzczytJest (now ToneValid) was not used correctly. ToneValid is set to true if a valid tone was found (= the sound was louder than the threshold -> no background noise). If i remember correctly the sound was accepted although the tone was invalid. So the old data was used although noone was singing. This resulted in some sort of ghost-singer effect. UIni: - moved TIni.Card to TScreenOptionsRecord.Card because it is not stored in the ini-file and will not be in the future. - TIni.CardList ist now TIni.InputDeviceConfig. The name cardlist was misleading because it just specifies input- but no output-devices. In addition a soundcard can have multiple input-devices (at least in linux). - bugfix on InputDeviceConfig (formerly CardList) usage. USDX expected that the indices of the corresponding elements in TIni.InputDeviceConfig[] and TAudioInputProcessor.Device[] were the same. This is wrong. If device 2 was defined at first place in the ini and device 1 at the second, the indices of the two arrays didn't match (they were swapped) erroneously. To fix this and to support the item listed below the index to TIni.InputDeviceConfig[] is now stored in TAudioInputDevice.CfgIndex. NOTE: InputDeviceConfig[] contains configurations of non-available (unplugged) devices. Iterate over TAudioInputProcessor.Device[] for available devices. - configurations of external devices that are not plugged in will not be deleted anymore. - multiple definitions of one device in the ini-file will not crash USDX anymore - CardList[I].ChannelL/R now are InputDeviceConfig[I].ChannelToPlayerMap[0/1]. I think the new name is more intuitive because it maps a channel to a player number. Now the both vars are joint to one array. Now it is possible to use loops to process them and we might support more than two input channels on one device in the future (if such devices exist) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@827 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenStatMain.pas | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Game/Code/Screens/UScreenStatMain.pas') diff --git a/Game/Code/Screens/UScreenStatMain.pas b/Game/Code/Screens/UScreenStatMain.pas index f7257201..53154d6e 100644 --- a/Game/Code/Screens/UScreenStatMain.pas +++ b/Game/Code/Screens/UScreenStatMain.pas @@ -62,7 +62,7 @@ begin SDLK_BACKSPACE : begin Ini.Save; - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenMain); end; SDLK_RETURN: @@ -70,12 +70,12 @@ begin //Exit Button Pressed if Interaction = 4 then begin - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenMain); end else //One of the Stats Buttons Pressed begin - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); ScreenStatDetail.Typ := Interaction; FadeTo(@ScreenStatDetail); end; -- cgit v1.2.3